diff options
author | Rob Landley <rob@landley.net> | 2005-08-13 00:26:01 +0000 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2005-08-13 00:26:01 +0000 |
commit | fc455b2101edbf97331384831de2989ce9cdb731 (patch) | |
tree | 521f09b4ca5cb42280e51c7618930ea4f0e68dfb /busybox/networking | |
parent | 365a345e92c25c60c977aa1596e31a1e6b9cea80 (diff) | |
download | busybox-w32-fc455b2101edbf97331384831de2989ce9cdb731.tar.gz busybox-w32-fc455b2101edbf97331384831de2989ce9cdb731.tar.bz2 busybox-w32-fc455b2101edbf97331384831de2989ce9cdb731.zip |
1.0 backports of:
10861, 10875, 10881, 10888 ash fix
10865 suid thing? (look at this)
10886 telnet bugfix
10866 ftp fix for RFC 959 compliance.
10867 Remove spurious newline from cp -i prompt.
10874 ksyslogd fix
10876 msh fix
10877 httpd fix
10880, 10889, 11005 dhcp fixes
Diffstat (limited to 'busybox/networking')
-rw-r--r-- | busybox/networking/ftpgetput.c | 4 | ||||
-rw-r--r-- | busybox/networking/httpd.c | 4 | ||||
-rw-r--r-- | busybox/networking/telnet.c | 14 | ||||
-rw-r--r-- | busybox/networking/udhcp/dhcpc.c | 19 |
4 files changed, 28 insertions, 13 deletions
diff --git a/busybox/networking/ftpgetput.c b/busybox/networking/ftpgetput.c index f6bd82bc8..02c21d9e1 100644 --- a/busybox/networking/ftpgetput.c +++ b/busybox/networking/ftpgetput.c | |||
@@ -65,9 +65,9 @@ static int ftpcmd(const char *s1, const char *s2, FILE *stream, char *buf) | |||
65 | 65 | ||
66 | if (s1) { | 66 | if (s1) { |
67 | if (s2) { | 67 | if (s2) { |
68 | fprintf(stream, "%s%s\n", s1, s2); | 68 | fprintf(stream, "%s%s\r\n", s1, s2); |
69 | } else { | 69 | } else { |
70 | fprintf(stream, "%s\n", s1); | 70 | fprintf(stream, "%s\r\n", s1); |
71 | } | 71 | } |
72 | } | 72 | } |
73 | do { | 73 | do { |
diff --git a/busybox/networking/httpd.c b/busybox/networking/httpd.c index 94fcfc8c1..e3f4027dc 100644 --- a/busybox/networking/httpd.c +++ b/busybox/networking/httpd.c | |||
@@ -1259,6 +1259,8 @@ static int sendCgi(const char *url, | |||
1259 | post_readed_idx += count; | 1259 | post_readed_idx += count; |
1260 | if(post_readed_size == 0) | 1260 | if(post_readed_size == 0) |
1261 | post_readed_idx = 0; | 1261 | post_readed_idx = 0; |
1262 | } else { | ||
1263 | post_readed_size = post_readed_idx = bodyLen = 0; /* broken pipe to CGI */ | ||
1262 | } | 1264 | } |
1263 | } else if(bodyLen > 0 && post_readed_size == 0 && FD_ISSET(a_c_r, &readSet)) { | 1265 | } else if(bodyLen > 0 && post_readed_size == 0 && FD_ISSET(a_c_r, &readSet)) { |
1264 | count = bodyLen > sizeof(wbuf) ? sizeof(wbuf) : bodyLen; | 1266 | count = bodyLen > sizeof(wbuf) ? sizeof(wbuf) : bodyLen; |
@@ -1266,7 +1268,7 @@ static int sendCgi(const char *url, | |||
1266 | if(count > 0) { | 1268 | if(count > 0) { |
1267 | post_readed_size += count; | 1269 | post_readed_size += count; |
1268 | bodyLen -= count; | 1270 | bodyLen -= count; |
1269 | } else { | 1271 | } else { |
1270 | bodyLen = 0; /* closed */ | 1272 | bodyLen = 0; /* closed */ |
1271 | } | 1273 | } |
1272 | } | 1274 | } |
diff --git a/busybox/networking/telnet.c b/busybox/networking/telnet.c index 6ad7712ab..24160057b 100644 --- a/busybox/networking/telnet.c +++ b/busybox/networking/telnet.c | |||
@@ -96,6 +96,7 @@ static struct Globalvars { | |||
96 | byte charmode; | 96 | byte charmode; |
97 | byte telflags; | 97 | byte telflags; |
98 | byte gotsig; | 98 | byte gotsig; |
99 | byte do_termios; | ||
99 | /* buffer to handle telnet negotiations */ | 100 | /* buffer to handle telnet negotiations */ |
100 | char iacbuf[IACBUFSIZE]; | 101 | char iacbuf[IACBUFSIZE]; |
101 | short iaclen; /* could even use byte */ | 102 | short iaclen; /* could even use byte */ |
@@ -616,12 +617,12 @@ static void fgotsig(int sig) | |||
616 | 617 | ||
617 | static void rawmode(void) | 618 | static void rawmode(void) |
618 | { | 619 | { |
619 | tcsetattr(0, TCSADRAIN, &G.termios_raw); | 620 | if (G.do_termios) tcsetattr(0, TCSADRAIN, &G.termios_raw); |
620 | } | 621 | } |
621 | 622 | ||
622 | static void cookmode(void) | 623 | static void cookmode(void) |
623 | { | 624 | { |
624 | tcsetattr(0, TCSADRAIN, &G.termios_def); | 625 | if (G.do_termios) tcsetattr(0, TCSADRAIN, &G.termios_def); |
625 | } | 626 | } |
626 | 627 | ||
627 | extern int telnet_main(int argc, char** argv) | 628 | extern int telnet_main(int argc, char** argv) |
@@ -649,11 +650,12 @@ extern int telnet_main(int argc, char** argv) | |||
649 | 650 | ||
650 | memset(&G, 0, sizeof G); | 651 | memset(&G, 0, sizeof G); |
651 | 652 | ||
652 | if (tcgetattr(0, &G.termios_def) < 0) | 653 | if (tcgetattr(0, &G.termios_def) >= 0) { |
653 | exit(1); | 654 | G.do_termios = 1; |
654 | 655 | ||
655 | G.termios_raw = G.termios_def; | 656 | G.termios_raw = G.termios_def; |
656 | cfmakeraw(&G.termios_raw); | 657 | cfmakeraw(&G.termios_raw); |
658 | } | ||
657 | 659 | ||
658 | if (argc < 2) | 660 | if (argc < 2) |
659 | bb_show_usage(); | 661 | bb_show_usage(); |
diff --git a/busybox/networking/udhcp/dhcpc.c b/busybox/networking/udhcp/dhcpc.c index 91af9153b..e89affe1f 100644 --- a/busybox/networking/udhcp/dhcpc.c +++ b/busybox/networking/udhcp/dhcpc.c | |||
@@ -76,7 +76,8 @@ static void __attribute__ ((noreturn)) show_usage(void) | |||
76 | { | 76 | { |
77 | printf( | 77 | printf( |
78 | "Usage: udhcpc [OPTIONS]\n\n" | 78 | "Usage: udhcpc [OPTIONS]\n\n" |
79 | " -c, --clientid=CLIENTID Client identifier\n" | 79 | " -c, --clientid=CLIENTID Set client identifier\n" |
80 | " -C, --clientid-none Suppress default client identifier\n" | ||
80 | " -H, --hostname=HOSTNAME Client hostname\n" | 81 | " -H, --hostname=HOSTNAME Client hostname\n" |
81 | " -h Alias for -H\n" | 82 | " -h Alias for -H\n" |
82 | " -f, --foreground Do not fork after getting lease\n" | 83 | " -f, --foreground Do not fork after getting lease\n" |
@@ -191,9 +192,11 @@ int main(int argc, char *argv[]) | |||
191 | long now; | 192 | long now; |
192 | int max_fd; | 193 | int max_fd; |
193 | int sig; | 194 | int sig; |
195 | int no_clientid = 0; | ||
194 | 196 | ||
195 | static const struct option arg_options[] = { | 197 | static const struct option arg_options[] = { |
196 | {"clientid", required_argument, 0, 'c'}, | 198 | {"clientid", required_argument, 0, 'c'}, |
199 | {"clientid-none", no_argument, 0, 'C'}, | ||
197 | {"foreground", no_argument, 0, 'f'}, | 200 | {"foreground", no_argument, 0, 'f'}, |
198 | {"background", no_argument, 0, 'b'}, | 201 | {"background", no_argument, 0, 'b'}, |
199 | {"hostname", required_argument, 0, 'H'}, | 202 | {"hostname", required_argument, 0, 'H'}, |
@@ -211,11 +214,12 @@ int main(int argc, char *argv[]) | |||
211 | /* get options */ | 214 | /* get options */ |
212 | while (1) { | 215 | while (1) { |
213 | int option_index = 0; | 216 | int option_index = 0; |
214 | c = getopt_long(argc, argv, "c:fbH:h:i:np:qr:s:v", arg_options, &option_index); | 217 | c = getopt_long(argc, argv, "c:CfbH:h:i:np:qr:s:v", arg_options, &option_index); |
215 | if (c == -1) break; | 218 | if (c == -1) break; |
216 | 219 | ||
217 | switch (c) { | 220 | switch (c) { |
218 | case 'c': | 221 | case 'c': |
222 | if (no_clientid) show_usage(); | ||
219 | len = strlen(optarg) > 255 ? 255 : strlen(optarg); | 223 | len = strlen(optarg) > 255 ? 255 : strlen(optarg); |
220 | if (client_config.clientid) free(client_config.clientid); | 224 | if (client_config.clientid) free(client_config.clientid); |
221 | client_config.clientid = xmalloc(len + 2); | 225 | client_config.clientid = xmalloc(len + 2); |
@@ -224,6 +228,10 @@ int main(int argc, char *argv[]) | |||
224 | client_config.clientid[OPT_DATA] = '\0'; | 228 | client_config.clientid[OPT_DATA] = '\0'; |
225 | strncpy(client_config.clientid + OPT_DATA, optarg, len); | 229 | strncpy(client_config.clientid + OPT_DATA, optarg, len); |
226 | break; | 230 | break; |
231 | case 'C': | ||
232 | if (client_config.clientid) show_usage(); | ||
233 | no_clientid = 1; | ||
234 | break; | ||
227 | case 'f': | 235 | case 'f': |
228 | client_config.foreground = 1; | 236 | client_config.foreground = 1; |
229 | break; | 237 | break; |
@@ -273,7 +281,8 @@ int main(int argc, char *argv[]) | |||
273 | NULL, client_config.arp) < 0) | 281 | NULL, client_config.arp) < 0) |
274 | return 1; | 282 | return 1; |
275 | 283 | ||
276 | if (!client_config.clientid) { | 284 | /* if not set, and not suppressed, setup the default client ID */ |
285 | if (!client_config.clientid && !no_clientid) { | ||
277 | client_config.clientid = xmalloc(6 + 3); | 286 | client_config.clientid = xmalloc(6 + 3); |
278 | client_config.clientid[OPT_CODE] = DHCP_CLIENT_ID; | 287 | client_config.clientid[OPT_CODE] = DHCP_CLIENT_ID; |
279 | client_config.clientid[OPT_LEN] = 7; | 288 | client_config.clientid[OPT_LEN] = 7; |
@@ -420,8 +429,10 @@ int main(int argc, char *argv[]) | |||
420 | continue; | 429 | continue; |
421 | } | 430 | } |
422 | /* Ignore packets that aren't for us */ | 431 | /* Ignore packets that aren't for us */ |
423 | if (memcmp(client_config.arp,packet.chaddr,6)) | 432 | if (memcmp(packet.chaddr, client_config.arp, 6)) { |
433 | DEBUG(LOG_INFO, "packet does not have our chaddr -- ignoring"); | ||
424 | continue; | 434 | continue; |
435 | } | ||
425 | 436 | ||
426 | if ((message = get_option(&packet, DHCP_MESSAGE_TYPE)) == NULL) { | 437 | if ((message = get_option(&packet, DHCP_MESSAGE_TYPE)) == NULL) { |
427 | DEBUG(LOG_ERR, "couldnt get option from packet -- ignoring"); | 438 | DEBUG(LOG_ERR, "couldnt get option from packet -- ignoring"); |