Contents of /trunk/netkit-rsh/patches/netkit-rsh-0.17-nohostcheck.patch
Parent Directory | Revision Log
Revision 153 -
(show annotations)
(download)
Tue May 8 20:52:56 2007 UTC (17 years, 4 months ago) by niro
File size: 4385 byte(s)
Tue May 8 20:52:56 2007 UTC (17 years, 4 months ago) by niro
File size: 4385 byte(s)
-import
1 | Binary files netkit-rsh-0.17.orig/rlogind/.error.txt.swp and netkit-rsh-0.17.new/rlogind/.error.txt.swp differ |
2 | diff -uNr netkit-rsh-0.17.orig/rlogind/network.c netkit-rsh-0.17.new/rlogind/network.c |
3 | --- netkit-rsh-0.17.orig/rlogind/network.c Wed Oct 8 12:29:50 2003 |
4 | +++ netkit-rsh-0.17.new/rlogind/network.c Wed Oct 8 13:44:42 2003 |
5 | @@ -90,7 +90,7 @@ |
6 | |
7 | |
8 | static char * |
9 | -find_hostname(const struct sockaddr_in *fromp, int *hostokp) |
10 | +find_hostname(const struct sockaddr_in *fromp, int no_host_check, int *hostokp) |
11 | { |
12 | struct hostent *hop; |
13 | char *hname; |
14 | @@ -102,7 +102,7 @@ |
15 | hname = strdup(inet_ntoa(fromp->sin_addr)); |
16 | hostok = 1; |
17 | } |
18 | - else if (check_all || local_domain(hop->h_name)) { |
19 | + else if ((check_all || local_domain(hop->h_name )) && !no_host_check ) { |
20 | /* |
21 | * If name returned by gethostbyaddr is in our domain, |
22 | * attempt to verify that we haven't been fooled by someone |
23 | @@ -143,7 +143,7 @@ |
24 | |
25 | |
26 | char * |
27 | -network_init(int f, int *hostokp) |
28 | +network_init(int f, int no_host_check, int *hostokp) |
29 | { |
30 | struct sockaddr_in from, *fromp; |
31 | socklen_t fromlen; |
32 | @@ -177,7 +177,7 @@ |
33 | |
34 | alarm(0); |
35 | |
36 | - hname = find_hostname(fromp, hostokp); |
37 | + hname = find_hostname(fromp,no_host_check, hostokp); |
38 | |
39 | port = ntohs(fromp->sin_port); |
40 | if (fromp->sin_family != AF_INET || |
41 | diff -uNr netkit-rsh-0.17.orig/rlogind/rlogind.c netkit-rsh-0.17.new/rlogind/rlogind.c |
42 | --- netkit-rsh-0.17.orig/rlogind/rlogind.c Wed Oct 8 12:29:50 2003 |
43 | +++ netkit-rsh-0.17.new/rlogind/rlogind.c Wed Oct 8 12:58:51 2003 |
44 | @@ -84,6 +84,7 @@ |
45 | int use_rhosts = 1; |
46 | int allow_root_rhosts = 0; |
47 | int deny_all_rhosts_hequiv = 0; |
48 | +static int no_host_check = 0; |
49 | |
50 | static char oobdata[] = {(char)TIOCPKT_WINDOW}; |
51 | static char line[MAXPATHLEN]; |
52 | @@ -386,7 +387,7 @@ |
53 | int hostok; |
54 | char lusername[32], rusername[32], termtype[256]; |
55 | |
56 | - hname = network_init(netfd, &hostok); |
57 | + hname = network_init(netfd, no_host_check, &hostok); |
58 | |
59 | getstr(rusername, sizeof(rusername), "remuser too long"); |
60 | getstr(lusername, sizeof(lusername), "locuser too long"); |
61 | @@ -439,15 +440,16 @@ |
62 | openlog("rlogind", LOG_PID | LOG_CONS, LOG_AUTH); |
63 | |
64 | opterr = 0; |
65 | - while ((ch = getopt(argc, argv, "ahLln")) != EOF) { |
66 | + while ((ch = getopt(argc, argv, "ahLlDn")) != EOF) { |
67 | switch (ch) { |
68 | case 'a': check_all = 1; break; |
69 | case 'h': allow_root_rhosts = 1; break; |
70 | case 'L': deny_all_rhosts_hequiv = 1; break; |
71 | case 'l': use_rhosts = 0; break; |
72 | + case 'D': no_host_check = 1; break; |
73 | case 'n': keepalive = 0; break; |
74 | case '?': default: |
75 | - syslog(LOG_ERR, "usage: rlogind [-ahLln]"); |
76 | + syslog(LOG_ERR, "usage: rlogind [-ahLlDn]"); |
77 | break; |
78 | } |
79 | } |
80 | diff -uNr netkit-rsh-0.17.orig/rlogind/rlogind.h netkit-rsh-0.17.new/rlogind/rlogind.h |
81 | --- netkit-rsh-0.17.orig/rlogind/rlogind.h Wed Oct 8 12:29:50 2003 |
82 | +++ netkit-rsh-0.17.new/rlogind/rlogind.h Wed Oct 8 12:58:50 2003 |
83 | @@ -3,7 +3,7 @@ |
84 | void fatal(int f, const char *msg, int syserr); |
85 | |
86 | /* network.c */ |
87 | -char *network_init(int fd, int *hostokp); |
88 | +char *network_init(int fd, int no_host_check, int *hostokp); |
89 | void network_confirm(void); |
90 | void network_anticonfirm(void); |
91 | void network_close(void); |
92 | diff -uNr netkit-rsh-0.17.orig/rshd/rshd.c netkit-rsh-0.17.new/rshd/rshd.c |
93 | --- netkit-rsh-0.17.orig/rshd/rshd.c Wed Oct 8 12:29:50 2003 |
94 | +++ netkit-rsh-0.17.new/rshd/rshd.c Wed Oct 8 10:43:04 2003 |
95 | @@ -90,13 +90,14 @@ |
96 | static pam_handle_t *pamh; |
97 | #endif /* USE_PAM */ |
98 | |
99 | -#define OPTIONS "ahlLn" |
100 | +#define OPTIONS "ahlLnD" |
101 | |
102 | static int keepalive = 1; |
103 | static int check_all = 0; |
104 | static int paranoid = 0; |
105 | static int sent_null; |
106 | -static int allow_root_rhosts=0; |
107 | +static int allow_root_rhosts = 0; |
108 | +static int no_host_check = 0; |
109 | |
110 | char username[20] = "USER="; |
111 | char homedir[64] = "HOME="; |
112 | @@ -305,6 +306,7 @@ |
113 | /* |
114 | * Attempt to confirm the DNS. |
115 | */ |
116 | + |
117 | #ifdef RES_DNSRCH |
118 | _res.options &= ~RES_DNSRCH; |
119 | #endif |
120 | @@ -323,6 +325,8 @@ |
121 | } |
122 | syslog(LOG_NOTICE, "Host addr %s not listed for host %s", |
123 | inet_ntoa(fromp->sin_addr), hp->h_name); |
124 | + if ( no_host_check == 1 ) |
125 | + return hostname; |
126 | fail("Host address mismatch for %s\n", |
127 | remuser, inet_ntoa(fromp->sin_addr), locuser, cmdbuf); |
128 | return NULL; /* not reachable */ |
129 | @@ -596,6 +600,10 @@ |
130 | paranoid = 1; |
131 | break; |
132 | |
133 | + case 'D': |
134 | + no_host_check = 1; |
135 | + break; |
136 | + |
137 | case '?': |
138 | default: |
139 | syslog(LOG_ERR, "usage: rshd [-%s]", OPTIONS); |