X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=networking%2Fhttpd.c;h=6dbc219e746e6ec5545a1d787d7c4964729dca4e;hb=765b0eed3ef29a80115708c3249d3a541509cd24;hp=a2a52b58aa20533c9a4d06f1e9039bbd1ab5f3ba;hpb=33d8d08f7818a6d10e14ad8397c61adfcd377a6f;p=oweals%2Fbusybox.git diff --git a/networking/httpd.c b/networking/httpd.c index a2a52b58a..6dbc219e7 100644 --- a/networking/httpd.c +++ b/networking/httpd.c @@ -1021,7 +1021,7 @@ static void send_headers(int responseNum) strftime(tmp_str, sizeof(tmp_str), RFC1123FMT, gmtime(&last_mod)); #if ENABLE_FEATURE_HTTPD_RANGES if (responseNum == HTTP_PARTIAL_CONTENT) { - len += sprintf(iobuf + len, "Content-Range: bytes %"OFF_FMT"d-%"OFF_FMT"d/%"OFF_FMT"d\r\n", + len += sprintf(iobuf + len, "Content-Range: bytes %"OFF_FMT"u-%"OFF_FMT"u/%"OFF_FMT"u\r\n", range_start, range_end, file_size); @@ -1032,7 +1032,7 @@ static void send_headers(int responseNum) #if ENABLE_FEATURE_HTTPD_RANGES "Accept-Ranges: bytes\r\n" #endif - "Last-Modified: %s\r\n%s %"OFF_FMT"d\r\n", + "Last-Modified: %s\r\n%s %"OFF_FMT"u\r\n", tmp_str, "Content-length:", file_size @@ -1145,13 +1145,14 @@ static NOINLINE void cgi_io_loop_and_exit(int fromCgi_rd, int toCgi_wr, int post /* post_len <= 0 && hdr_cnt <= 0: * no more POST data to CGI, * let CGI see EOF on CGI's stdin */ - close(toCgi_wr); + if (toCgi_wr != fromCgi_rd) + close(toCgi_wr); toCgi_wr = 0; } } /* Now wait on the set of sockets */ - count = safe_poll(pfd, 3, -1); + count = safe_poll(pfd, toCgi_wr ? TO_CGI+1 : FROM_CGI+1, -1); if (count <= 0) { #if 0 if (safe_waitpid(pid, &status, WNOHANG) <= 0) { @@ -1432,7 +1433,7 @@ static void send_cgi_and_exit( if (script != url) { /* paranoia */ *script = '\0'; if (chdir(url + 1) != 0) { - bb_perror_msg("chdir %s", url + 1); + bb_perror_msg("chdir(%s)", url + 1); goto error_execing_cgi; } // not needed: *script = '/'; @@ -2103,8 +2104,7 @@ static void handle_incoming_and_exit(const len_and_sockaddr *fromAddr) header_ptr += 2; write(proxy_fd, header_buf, header_ptr - header_buf); free(header_buf); /* on the order of 8k, free it */ - /* cgi_io_loop_and_exit needs to have two distinct fds */ - cgi_io_loop_and_exit(proxy_fd, dup(proxy_fd), length); + cgi_io_loop_and_exit(proxy_fd, proxy_fd, length); } #endif @@ -2347,7 +2347,12 @@ int httpd_main(int argc UNUSED_PARAM, char **argv) #endif #if ENABLE_FEATURE_HTTPD_AUTH_MD5 if (opt & OPT_MD5) { - puts(pw_encrypt(pass, "$1$", 1)); + char salt[sizeof("$1$XXXXXXXX")]; + salt[0] = '$'; + salt[1] = '1'; + salt[2] = '$'; + crypt_make_salt(salt + 3, 4, 0); + puts(pw_encrypt(pass, salt, 1)); return 0; } #endif