diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2009-09-12 17:57:19 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2009-09-12 17:57:19 +0200 |
commit | d7686c8c2c849c775007c5de19901ab6b38bd039 (patch) | |
tree | 8d4017407166a4f16a0fecd7921a8d03975636bf /networking | |
parent | e7aa0d9eca180f77ed4226ecaa1e8961d842add7 (diff) | |
download | busybox-w32-1_15_1.tar.gz busybox-w32-1_15_1.tar.bz2 busybox-w32-1_15_1.zip |
Apply post-1.15.0 fixes; bump version to 1.15.11_15_1
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking')
-rw-r--r-- | networking/httpd.c | 30 | ||||
-rw-r--r-- | networking/inetd.c | 25 |
2 files changed, 30 insertions, 25 deletions
diff --git a/networking/httpd.c b/networking/httpd.c index 956eecaf2..bc081c1bd 100644 --- a/networking/httpd.c +++ b/networking/httpd.c | |||
@@ -2101,8 +2101,12 @@ static void handle_incoming_and_exit(const len_and_sockaddr *fromAddr) | |||
2101 | } | 2101 | } |
2102 | send_cgi_and_exit(urlcopy, prequest, length, cookie, content_type); | 2102 | send_cgi_and_exit(urlcopy, prequest, length, cookie, content_type); |
2103 | } | 2103 | } |
2104 | #endif | ||
2105 | |||
2106 | if (urlp[-1] == '/') | ||
2107 | strcpy(urlp, index_page); | ||
2108 | if (stat(tptr, &sb) == 0) { | ||
2104 | #if ENABLE_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR | 2109 | #if ENABLE_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR |
2105 | { | ||
2106 | char *suffix = strrchr(tptr, '.'); | 2110 | char *suffix = strrchr(tptr, '.'); |
2107 | if (suffix) { | 2111 | if (suffix) { |
2108 | Htaccess *cur; | 2112 | Htaccess *cur; |
@@ -2112,16 +2116,7 @@ static void handle_incoming_and_exit(const len_and_sockaddr *fromAddr) | |||
2112 | } | 2116 | } |
2113 | } | 2117 | } |
2114 | } | 2118 | } |
2115 | } | ||
2116 | #endif | 2119 | #endif |
2117 | if (prequest != request_GET && prequest != request_HEAD) { | ||
2118 | send_headers_and_exit(HTTP_NOT_IMPLEMENTED); | ||
2119 | } | ||
2120 | #endif /* FEATURE_HTTPD_CGI */ | ||
2121 | |||
2122 | if (urlp[-1] == '/') | ||
2123 | strcpy(urlp, index_page); | ||
2124 | if (stat(tptr, &sb) == 0) { | ||
2125 | file_size = sb.st_size; | 2120 | file_size = sb.st_size; |
2126 | last_mod = sb.st_mtime; | 2121 | last_mod = sb.st_mtime; |
2127 | } | 2122 | } |
@@ -2135,19 +2130,18 @@ static void handle_incoming_and_exit(const len_and_sockaddr *fromAddr) | |||
2135 | send_cgi_and_exit("/cgi-bin/index.cgi", prequest, length, cookie, content_type); | 2130 | send_cgi_and_exit("/cgi-bin/index.cgi", prequest, length, cookie, content_type); |
2136 | } | 2131 | } |
2137 | } | 2132 | } |
2138 | #endif | 2133 | /* else fall through to send_file, it errors out if open fails: */ |
2139 | /* else { | ||
2140 | * fall through to send_file, it errors out if open fails | ||
2141 | * } | ||
2142 | */ | ||
2143 | 2134 | ||
2135 | if (prequest != request_GET && prequest != request_HEAD) { | ||
2136 | /* POST for files does not make sense */ | ||
2137 | send_headers_and_exit(HTTP_NOT_IMPLEMENTED); | ||
2138 | } | ||
2144 | send_file_and_exit(tptr, | 2139 | send_file_and_exit(tptr, |
2145 | #if ENABLE_FEATURE_HTTPD_CGI | ||
2146 | (prequest != request_HEAD ? SEND_HEADERS_AND_BODY : SEND_HEADERS) | 2140 | (prequest != request_HEAD ? SEND_HEADERS_AND_BODY : SEND_HEADERS) |
2141 | ); | ||
2147 | #else | 2142 | #else |
2148 | SEND_HEADERS_AND_BODY | 2143 | send_file_and_exit(tptr, SEND_HEADERS_AND_BODY); |
2149 | #endif | 2144 | #endif |
2150 | ); | ||
2151 | } | 2145 | } |
2152 | 2146 | ||
2153 | /* | 2147 | /* |
diff --git a/networking/inetd.c b/networking/inetd.c index 331c49441..391bb9ba6 100644 --- a/networking/inetd.c +++ b/networking/inetd.c | |||
@@ -1031,10 +1031,10 @@ static void reap_child(int sig UNUSED_PARAM) | |||
1031 | continue; | 1031 | continue; |
1032 | /* One of our "wait" services */ | 1032 | /* One of our "wait" services */ |
1033 | if (WIFEXITED(status) && WEXITSTATUS(status)) | 1033 | if (WIFEXITED(status) && WEXITSTATUS(status)) |
1034 | bb_error_msg("%s: exit status 0x%x", | 1034 | bb_error_msg("%s: exit status %u", |
1035 | sep->se_program, WEXITSTATUS(status)); | 1035 | sep->se_program, WEXITSTATUS(status)); |
1036 | else if (WIFSIGNALED(status)) | 1036 | else if (WIFSIGNALED(status)) |
1037 | bb_error_msg("%s: exit signal 0x%x", | 1037 | bb_error_msg("%s: exit signal %u", |
1038 | sep->se_program, WTERMSIG(status)); | 1038 | sep->se_program, WTERMSIG(status)); |
1039 | sep->se_wait = 1; | 1039 | sep->se_wait = 1; |
1040 | add_fd_to_set(sep->se_fd); | 1040 | add_fd_to_set(sep->se_fd); |
@@ -1119,7 +1119,12 @@ int inetd_main(int argc UNUSED_PARAM, char **argv) | |||
1119 | else | 1119 | else |
1120 | bb_sanitize_stdio(); | 1120 | bb_sanitize_stdio(); |
1121 | if (!(opt & 4)) { | 1121 | if (!(opt & 4)) { |
1122 | openlog(applet_name, LOG_PID, LOG_DAEMON); | 1122 | /* LOG_NDELAY: connect to syslog daemon NOW. |
1123 | * Otherwise, we may open syslog socket | ||
1124 | * in vforked child, making opened fds and syslog() | ||
1125 | * internal state inconsistent. | ||
1126 | * This was observed to leak file descriptors. */ | ||
1127 | openlog(applet_name, LOG_PID | LOG_NDELAY, LOG_DAEMON); | ||
1123 | logmode = LOGMODE_SYSLOG; | 1128 | logmode = LOGMODE_SYSLOG; |
1124 | } | 1129 | } |
1125 | 1130 | ||
@@ -1355,17 +1360,23 @@ int inetd_main(int argc UNUSED_PARAM, char **argv) | |||
1355 | if (rlim_ofile.rlim_cur != rlim_ofile_cur) | 1360 | if (rlim_ofile.rlim_cur != rlim_ofile_cur) |
1356 | if (setrlimit(RLIMIT_NOFILE, &rlim_ofile) < 0) | 1361 | if (setrlimit(RLIMIT_NOFILE, &rlim_ofile) < 0) |
1357 | bb_perror_msg("setrlimit"); | 1362 | bb_perror_msg("setrlimit"); |
1358 | closelog(); | 1363 | |
1364 | /* closelog(); - WRONG. we are after vfork, | ||
1365 | * this may confuse syslog() internal state. | ||
1366 | * Let's hope libc sets syslog fd to CLOEXEC... | ||
1367 | */ | ||
1359 | xmove_fd(ctrl, STDIN_FILENO); | 1368 | xmove_fd(ctrl, STDIN_FILENO); |
1360 | xdup2(STDIN_FILENO, STDOUT_FILENO); | 1369 | xdup2(STDIN_FILENO, STDOUT_FILENO); |
1361 | /* manpages of inetd I managed to find either say | 1370 | /* manpages of inetd I managed to find either say |
1362 | * that stderr is also redirected to the network, | 1371 | * that stderr is also redirected to the network, |
1363 | * or do not talk about redirection at all (!) */ | 1372 | * or do not talk about redirection at all (!) */ |
1364 | xdup2(STDIN_FILENO, STDERR_FILENO); | 1373 | if (!sep->se_wait) /* only for usual "tcp nowait" */ |
1365 | /* NB: among others, this loop closes listening socket | 1374 | xdup2(STDIN_FILENO, STDERR_FILENO); |
1375 | /* NB: among others, this loop closes listening sockets | ||
1366 | * for nowait stream children */ | 1376 | * for nowait stream children */ |
1367 | for (sep2 = serv_list; sep2; sep2 = sep2->se_next) | 1377 | for (sep2 = serv_list; sep2; sep2 = sep2->se_next) |
1368 | maybe_close(sep2->se_fd); | 1378 | if (sep2->se_fd != ctrl) |
1379 | maybe_close(sep2->se_fd); | ||
1369 | sigaction_set(SIGPIPE, &saved_pipe_handler); | 1380 | sigaction_set(SIGPIPE, &saved_pipe_handler); |
1370 | restore_sigmask(&omask); | 1381 | restore_sigmask(&omask); |
1371 | BB_EXECVP(sep->se_program, sep->se_argv); | 1382 | BB_EXECVP(sep->se_program, sep->se_argv); |