Magellan Linux

Annotation of /trunk/netkit-rsh/netkit-rsh-0.17-prompt.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 97 - (hide annotations) (download)
Fri Jan 19 23:50:26 2007 UTC (17 years, 4 months ago) by niro
File size: 1145 byte(s)
new files

1 niro 97 --- netkit-rsh-0.16/rexec/rexec.c.prompt Mon Feb 28 16:23:33 2000
2     +++ netkit-rsh-0.16/rexec/rexec.c Mon Feb 28 16:49:23 2000
3     @@ -164,12 +164,30 @@
4     user_name[strlen(user_name)-1] = '\0'; /* Hopefully fgets always adds
5     a newline. */
6     passwd = getpass("Password: ");
7     + } else {
8     +
9     + if ( user_name == NULL )
10     + user_name = getenv("REXEC_USER");
11     + if ( user_name == NULL ) {
12     + uid_t uid = getuid();
13     + struct passwd *pw = getpwuid(uid);
14     + if (!(pw && pw->pw_name)) {
15     + fprintf(stderr, "Can't lookup uid %d\n", uid);
16     + exit(1);
17     + }
18     + user_name = strdup(pw->pw_name);
19     + }
20     + if ( passwd == NULL )
21     + passwd = getenv("REXEC_PASS");
22     + if ( passwd == NULL )
23     + passwd = getpass("Password: ");
24     }
25    
26     - if ( user_name == NULL )
27     - user_name = getenv("REXEC_USER");
28     - if ( passwd == NULL )
29     - passwd = getenv("REXEC_PASS");
30     + if (!(user_name && passwd)) {
31     + fprintf(stderr, "Can't use %s without supplying a user and password\n",
32     + progname);
33     + exit(1);
34     + }
35    
36     if ( (sock = rexec(&host, port_exec, user_name, passwd, command,
37     p_to_aux_sock)) < 0 )