Magellan Linux

Annotation of /trunk/netkit-rsh/netkit-rsh-0.17-userandhost.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: 2188 byte(s)
new files

1 niro 97 --- netkit-rsh-0.17/rlogind/rlogind.c.userandhost 2000-07-23 05:07:58.000000000 +0200
2     +++ netkit-rsh-0.17/rlogind/rlogind.c 2003-01-17 17:31:25.000000000 +0100
3     @@ -333,9 +333,10 @@
4    
5    
6     static void child(const char *hname, const char *termtype,
7     - const char *localuser, int authenticated)
8     + const char *localuser, int authenticated,
9     + const char *rusername)
10     {
11     - char *termenv[2];
12     + char *termenv[4];
13    
14     setup_term(0, termtype);
15    
16     @@ -344,7 +345,17 @@
17     strcpy(termenv[0], "TERM=");
18     strcat(termenv[0], termtype);
19     }
20     - termenv[1] = NULL;
21     + termenv[1] = malloc(strlen(rusername)+12);
22     + if (termenv[1]) { /* shouldn't ever fail, mind you */
23     + strcpy(termenv[1], "REMOTEUSER=");
24     + strcat(termenv[1], rusername);
25     + }
26     + termenv[2] = malloc(strlen(hname)+12);
27     + if (termenv[2]) { /* shouldn't ever fail, mind you */
28     + strcpy(termenv[2], "REMOTEHOST=");
29     + strcat(termenv[2], hname);
30     + }
31     + termenv[3] = NULL;
32    
33     if (authenticated) {
34     auth_finish();
35     @@ -420,7 +431,7 @@
36     if (pid == 0) {
37     /* netfd should always be 0, but... */
38     if (netfd > 2) close(netfd);
39     - child(hname, termtype, lusername, authenticated);
40     + child(hname, termtype, lusername, authenticated, rusername);
41     }
42     on = 1;
43     ioctl(netfd, FIONBIO, &on);
44     --- netkit-rsh-0.17/rshd/rshd.c.userandhost 2003-01-17 17:25:22.000000000 +0100
45     +++ netkit-rsh-0.17/rshd/rshd.c 2003-01-17 17:25:22.000000000 +0100
46     @@ -102,8 +102,10 @@
47     char homedir[64] = "HOME=";
48     char shell[64] = "SHELL=";
49     char path[100] = "PATH=";
50     +char remoteuser[20] = "REMOTEUSER=";
51     +char remotehost[50] = "REMOTEHOST=";
52     char *envinit[] =
53     - {homedir, shell, path, username, 0};
54     + {homedir, shell, path, username, remoteuser, remotehost, 0};
55     extern char **environ;
56    
57     static void error(const char *fmt, ...);
58     @@ -460,6 +462,12 @@
59     strncat(homedir, pwd->pw_dir, sizeof(homedir)-6);
60     homedir[sizeof(homedir)-1] = 0;
61    
62     + strncat(remoteuser, remuser, sizeof(remoteuser)-12);
63     + remoteuser[sizeof(remoteuser)-1] = 0;
64     +
65     + strncat(remotehost, hostname, sizeof(remotehost)-12);
66     + remotehost[sizeof(remotehost)-1] = 0;
67     +
68     strcat(path, _PATH_DEFPATH);
69    
70     strncat(shell, theshell, sizeof(shell)-7);