You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.1 KiB
38 lines
1.1 KiB
6 years ago
|
--- netkit-rsh-0.16/rexec/rexec.c.prompt Mon Feb 28 16:23:33 2000
|
||
|
+++ netkit-rsh-0.16/rexec/rexec.c Mon Feb 28 16:49:23 2000
|
||
|
@@ -164,12 +164,30 @@
|
||
|
user_name[strlen(user_name)-1] = '\0'; /* Hopefully fgets always adds
|
||
|
a newline. */
|
||
|
passwd = getpass("Password: ");
|
||
|
+ } else {
|
||
|
+
|
||
|
+ if ( user_name == NULL )
|
||
|
+ user_name = getenv("REXEC_USER");
|
||
|
+ if ( user_name == NULL ) {
|
||
|
+ uid_t uid = getuid();
|
||
|
+ struct passwd *pw = getpwuid(uid);
|
||
|
+ if (!(pw && pw->pw_name)) {
|
||
|
+ fprintf(stderr, "Can't lookup uid %d\n", uid);
|
||
|
+ exit(1);
|
||
|
+ }
|
||
|
+ user_name = strdup(pw->pw_name);
|
||
|
+ }
|
||
|
+ if ( passwd == NULL )
|
||
|
+ passwd = getenv("REXEC_PASS");
|
||
|
+ if ( passwd == NULL )
|
||
|
+ passwd = getpass("Password: ");
|
||
|
}
|
||
|
|
||
|
- if ( user_name == NULL )
|
||
|
- user_name = getenv("REXEC_USER");
|
||
|
- if ( passwd == NULL )
|
||
|
- passwd = getenv("REXEC_PASS");
|
||
|
+ if (!(user_name && passwd)) {
|
||
|
+ fprintf(stderr, "Can't use %s without supplying a user and password\n",
|
||
|
+ progname);
|
||
|
+ exit(1);
|
||
|
+ }
|
||
|
|
||
|
if ( (sock = rexec(&host, port_exec, user_name, passwd, command,
|
||
|
p_to_aux_sock)) < 0 )
|