← Commit list

049670fbb

Alexander Vickberg
Alexander Vickberg
2019-04-18
SUCCESS Duration: 150s

Subject

httpd: pass authorization header to CGI if not Basic

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

networking/httpd.c+7 -7
@@ -2384,7 +2384,7 @@ static void handle_incoming_and_exit(const len_and_sockaddr *fromAddr)
bb_error_msg("header: '%s'", iobuf);
#if ENABLE_FEATURE_HTTPD_CGI || ENABLE_FEATURE_HTTPD_PROXY
/* Try and do our best to parse more lines */
- if ((STRNCASECMP(iobuf, "Content-Length:") == 0)) {
+ if (STRNCASECMP(iobuf, "Content-Length:") == 0) {
/* extra read only for POST */
if (prequest != request_GET
# if ENABLE_FEATURE_HTTPD_CGI
@@ -2410,13 +2410,13 @@ static void handle_incoming_and_exit(const len_and_sockaddr *fromAddr)
* "<user>:<passwd>" is base64 encoded.
*/
tptr = skip_whitespace(iobuf + sizeof("Authorization:")-1);
- if (STRNCASECMP(tptr, "Basic") != 0)
+ if (STRNCASECMP(tptr, "Basic") == 0) {
+ tptr += sizeof("Basic")-1;
+ /* decodeBase64() skips whitespace itself */
+ decodeBase64(tptr);
+ authorized = check_user_passwd(urlcopy, tptr);
continue;
- tptr += sizeof("Basic")-1;
- /* decodeBase64() skips whitespace itself */
- decodeBase64(tptr);
- authorized = check_user_passwd(urlcopy, tptr);
- continue;
+ }
}
#endif
#if ENABLE_FEATURE_HTTPD_RANGES