diff options
author | Ron Yorston <rmy@pobox.com> | 2012-03-22 16:14:13 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2012-03-22 16:14:13 +0000 |
commit | 800c3f176fb21e30fbaa81ef68f50e601ea2f78b (patch) | |
tree | 84f4a2bf30d3208a020b25c82c11ac636c7072c6 /networking | |
parent | 9db164d6e39050d09f38288c6045cd2a2cbf6d63 (diff) | |
parent | f99811908419608e3ab81393d0177cc456101e4b (diff) | |
download | busybox-w32-800c3f176fb21e30fbaa81ef68f50e601ea2f78b.tar.gz busybox-w32-800c3f176fb21e30fbaa81ef68f50e601ea2f78b.tar.bz2 busybox-w32-800c3f176fb21e30fbaa81ef68f50e601ea2f78b.zip |
Merge commit '1_19_4' into merge_1_19
Diffstat (limited to 'networking')
-rw-r--r-- | networking/inetd.c | 14 | ||||
-rw-r--r-- | networking/tftp.c | 3 | ||||
-rw-r--r-- | networking/wget.c | 6 |
3 files changed, 16 insertions, 7 deletions
diff --git a/networking/inetd.c b/networking/inetd.c index 873fd9528..05ad8c792 100644 --- a/networking/inetd.c +++ b/networking/inetd.c | |||
@@ -1278,6 +1278,7 @@ int inetd_main(int argc UNUSED_PARAM, char **argv) | |||
1278 | sep->se_count = 0; | 1278 | sep->se_count = 0; |
1279 | rearm_alarm(); /* will revive it in RETRYTIME sec */ | 1279 | rearm_alarm(); /* will revive it in RETRYTIME sec */ |
1280 | restore_sigmask(&omask); | 1280 | restore_sigmask(&omask); |
1281 | maybe_close(new_udp_fd); | ||
1281 | maybe_close(accepted_fd); | 1282 | maybe_close(accepted_fd); |
1282 | continue; /* -> check next fd in fd set */ | 1283 | continue; /* -> check next fd in fd set */ |
1283 | } | 1284 | } |
@@ -1298,17 +1299,18 @@ int inetd_main(int argc UNUSED_PARAM, char **argv) | |||
1298 | bb_perror_msg("vfork"+1); | 1299 | bb_perror_msg("vfork"+1); |
1299 | sleep(1); | 1300 | sleep(1); |
1300 | restore_sigmask(&omask); | 1301 | restore_sigmask(&omask); |
1302 | maybe_close(new_udp_fd); | ||
1301 | maybe_close(accepted_fd); | 1303 | maybe_close(accepted_fd); |
1302 | continue; /* -> check next fd in fd set */ | 1304 | continue; /* -> check next fd in fd set */ |
1303 | } | 1305 | } |
1304 | if (pid == 0) | 1306 | if (pid == 0) |
1305 | pid--; /* -1: "we did fork and we are child" */ | 1307 | pid--; /* -1: "we did fork and we are child" */ |
1306 | } | 1308 | } |
1307 | /* if pid == 0 here, we never forked */ | 1309 | /* if pid == 0 here, we didn't fork */ |
1308 | 1310 | ||
1309 | if (pid > 0) { /* parent */ | 1311 | if (pid > 0) { /* parent */ |
1310 | if (sep->se_wait) { | 1312 | if (sep->se_wait) { |
1311 | /* tcp wait: we passed listening socket to child, | 1313 | /* wait: we passed socket to child, |
1312 | * will wait for child to terminate */ | 1314 | * will wait for child to terminate */ |
1313 | sep->se_wait = pid; | 1315 | sep->se_wait = pid; |
1314 | remove_fd_from_set(sep->se_fd); | 1316 | remove_fd_from_set(sep->se_fd); |
@@ -1345,9 +1347,13 @@ int inetd_main(int argc UNUSED_PARAM, char **argv) | |||
1345 | setsid(); | 1347 | setsid(); |
1346 | /* "nowait" udp */ | 1348 | /* "nowait" udp */ |
1347 | if (new_udp_fd >= 0) { | 1349 | if (new_udp_fd >= 0) { |
1348 | len_and_sockaddr *lsa = xzalloc_lsa(sep->se_family); | 1350 | len_and_sockaddr *lsa; |
1351 | int r; | ||
1352 | |||
1353 | close(new_udp_fd); | ||
1354 | lsa = xzalloc_lsa(sep->se_family); | ||
1349 | /* peek at the packet and remember peer addr */ | 1355 | /* peek at the packet and remember peer addr */ |
1350 | int r = recvfrom(ctrl, NULL, 0, MSG_PEEK|MSG_DONTWAIT, | 1356 | r = recvfrom(ctrl, NULL, 0, MSG_PEEK|MSG_DONTWAIT, |
1351 | &lsa->u.sa, &lsa->len); | 1357 | &lsa->u.sa, &lsa->len); |
1352 | if (r < 0) | 1358 | if (r < 0) |
1353 | goto do_exit1; | 1359 | goto do_exit1; |
diff --git a/networking/tftp.c b/networking/tftp.c index 17485a527..043b879af 100644 --- a/networking/tftp.c +++ b/networking/tftp.c | |||
@@ -813,7 +813,8 @@ int tftpd_main(int argc UNUSED_PARAM, char **argv) | |||
813 | goto err; | 813 | goto err; |
814 | } | 814 | } |
815 | mode = local_file + strlen(local_file) + 1; | 815 | mode = local_file + strlen(local_file) + 1; |
816 | if (mode >= block_buf + result || strcmp(mode, "octet") != 0) { | 816 | /* RFC 1350 says mode string is case independent */ |
817 | if (mode >= block_buf + result || strcasecmp(mode, "octet") != 0) { | ||
817 | goto err; | 818 | goto err; |
818 | } | 819 | } |
819 | # if ENABLE_FEATURE_TFTP_BLOCKSIZE | 820 | # if ENABLE_FEATURE_TFTP_BLOCKSIZE |
diff --git a/networking/wget.c b/networking/wget.c index eca673a86..24b0d93c8 100644 --- a/networking/wget.c +++ b/networking/wget.c | |||
@@ -552,6 +552,7 @@ static void download_one_url(const char *url) | |||
552 | FILE *dfp; /* socket to ftp server (data) */ | 552 | FILE *dfp; /* socket to ftp server (data) */ |
553 | char *proxy = NULL; | 553 | char *proxy = NULL; |
554 | char *fname_out_alloc; | 554 | char *fname_out_alloc; |
555 | char *redirected_path = NULL; | ||
555 | struct host_info server; | 556 | struct host_info server; |
556 | struct host_info target; | 557 | struct host_info target; |
557 | 558 | ||
@@ -794,8 +795,8 @@ However, in real world it was observed that some web servers | |||
794 | bb_error_msg_and_die("too many redirections"); | 795 | bb_error_msg_and_die("too many redirections"); |
795 | fclose(sfp); | 796 | fclose(sfp); |
796 | if (str[0] == '/') { | 797 | if (str[0] == '/') { |
797 | free(target.allocated); | 798 | free(redirected_path); |
798 | target.path = target.allocated = xstrdup(str+1); | 799 | target.path = redirected_path = xstrdup(str+1); |
799 | /* lsa stays the same: it's on the same server */ | 800 | /* lsa stays the same: it's on the same server */ |
800 | } else { | 801 | } else { |
801 | parse_url(str, &target); | 802 | parse_url(str, &target); |
@@ -850,6 +851,7 @@ However, in real world it was observed that some web servers | |||
850 | free(server.allocated); | 851 | free(server.allocated); |
851 | free(target.allocated); | 852 | free(target.allocated); |
852 | free(fname_out_alloc); | 853 | free(fname_out_alloc); |
854 | free(redirected_path); | ||
853 | } | 855 | } |
854 | 856 | ||
855 | int wget_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 857 | int wget_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |