summaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2006-12-30 17:57:03 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2006-12-30 17:57:03 +0000
commit3bba545a54addf59b63a003e7ada03fd8b29b5ba (patch)
tree948ce196f871abcf9410ca1521a3d2a5af6a3082 /networking
parentb5a122b6f9643fb052d31390e435397960289154 (diff)
downloadbusybox-w32-3bba545a54addf59b63a003e7ada03fd8b29b5ba.tar.gz
busybox-w32-3bba545a54addf59b63a003e7ada03fd8b29b5ba.tar.bz2
busybox-w32-3bba545a54addf59b63a003e7ada03fd8b29b5ba.zip
done a dozen of randconfig test. guess what? ALL failed...
these are resulting fixes
Diffstat (limited to 'networking')
-rw-r--r--networking/httpd.c44
1 files changed, 23 insertions, 21 deletions
diff --git a/networking/httpd.c b/networking/httpd.c
index 49c2c76be..e50955ddc 100644
--- a/networking/httpd.c
+++ b/networking/httpd.c
@@ -338,7 +338,9 @@ static int scan_ip_mask(const char *ipm, unsigned int *ip, unsigned int *mask)
338 return 0; 338 return 0;
339} 339}
340 340
341#if ENABLE_FEATURE_HTTPD_BASIC_AUTH || ENABLE_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES 341#if ENABLE_FEATURE_HTTPD_BASIC_AUTH \
342 || ENABLE_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES \
343 || ENABLE_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR
342static void free_config_lines(Htaccess **pprev) 344static void free_config_lines(Htaccess **pprev)
343{ 345{
344 Htaccess *prev = *pprev; 346 Htaccess *prev = *pprev;
@@ -387,8 +389,11 @@ static void parse_conf(const char *path, int flag)
387{ 389{
388 FILE *f; 390 FILE *f;
389#if ENABLE_FEATURE_HTTPD_BASIC_AUTH 391#if ENABLE_FEATURE_HTTPD_BASIC_AUTH
390 Htaccess *prev, *cur; 392 Htaccess *prev;
391#elif ENABLE_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES 393#endif
394#if ENABLE_FEATURE_HTTPD_BASIC_AUTH \
395 || ENABLE_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES \
396 || ENABLE_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR
392 Htaccess *cur; 397 Htaccess *cur;
393#endif 398#endif
394 399
@@ -410,7 +415,9 @@ static void parse_conf(const char *path, int flag)
410 415
411 config->flg_deny_all = 0; 416 config->flg_deny_all = 0;
412 417
413#if ENABLE_FEATURE_HTTPD_BASIC_AUTH || ENABLE_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES || ENABLE_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR 418#if ENABLE_FEATURE_HTTPD_BASIC_AUTH \
419 || ENABLE_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES \
420 || ENABLE_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR
414 /* retain previous auth and mime config only for subdir parse */ 421 /* retain previous auth and mime config only for subdir parse */
415 if (flag != SUBDIR_PARSE) { 422 if (flag != SUBDIR_PARSE) {
416#if ENABLE_FEATURE_HTTPD_BASIC_AUTH 423#if ENABLE_FEATURE_HTTPD_BASIC_AUTH
@@ -559,7 +566,9 @@ static void parse_conf(const char *path, int flag)
559 } 566 }
560#endif 567#endif
561 568
562#if ENABLE_FEATURE_HTTPD_BASIC_AUTH || ENABLE_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES || ENABLE_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR 569#if ENABLE_FEATURE_HTTPD_BASIC_AUTH \
570 || ENABLE_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES \
571 || ENABLE_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR
563 /* storing current config line */ 572 /* storing current config line */
564 cur = calloc(1, sizeof(Htaccess) + strlen(p0)); 573 cur = calloc(1, sizeof(Htaccess) + strlen(p0));
565 if (cur) { 574 if (cur) {
@@ -1305,8 +1314,9 @@ static int checkPermIP(void)
1305 1314
1306 /* This could stand some work */ 1315 /* This could stand some work */
1307 for (cur = config->ip_a_d; cur; cur = cur->next) { 1316 for (cur = config->ip_a_d; cur; cur = cur->next) {
1308 if (DEBUG) 1317#if DEBUG
1309 fprintf(stderr, "checkPermIP: '%s' ? ", config->rmt_ip_str); 1318 fprintf(stderr, "checkPermIP: '%s' ? ", config->rmt_ip_str);
1319#endif
1310 if (DEBUG) 1320 if (DEBUG)
1311 fprintf(stderr, "'%u.%u.%u.%u/%u.%u.%u.%u'\n", 1321 fprintf(stderr, "'%u.%u.%u.%u/%u.%u.%u.%u'\n",
1312 (unsigned char)(cur->ip >> 24), 1322 (unsigned char)(cur->ip >> 24),
@@ -1589,7 +1599,8 @@ static void handleIncoming(void)
1589 /* extra read only for POST */ 1599 /* extra read only for POST */
1590 if (prequest != request_GET) { 1600 if (prequest != request_GET) {
1591 test = buf + sizeof("Content-length:")-1; 1601 test = buf + sizeof("Content-length:")-1;
1592 if (!test[0]) goto bail_out; 1602 if (!test[0])
1603 goto bail_out;
1593 errno = 0; 1604 errno = 0;
1594 /* not using strtoul: it ignores leading munis! */ 1605 /* not using strtoul: it ignores leading munis! */
1595 length = strtol(test, &test, 10); 1606 length = strtol(test, &test, 10);
@@ -1690,7 +1701,9 @@ static void handleIncoming(void)
1690 config->ContentLength = -1; 1701 config->ContentLength = -1;
1691 } while (0); 1702 } while (0);
1692 1703
1704#if ENABLE_FEATURE_HTTPD_CGI
1693 bail_out: 1705 bail_out:
1706#endif
1694 1707
1695 if (DEBUG) 1708 if (DEBUG)
1696 fprintf(stderr, "closing socket\n\n"); 1709 fprintf(stderr, "closing socket\n\n");
@@ -1910,20 +1923,9 @@ int httpd_main(int argc, char *argv[])
1910 1923
1911#if ENABLE_FEATURE_HTTPD_SETUID 1924#if ENABLE_FEATURE_HTTPD_SETUID
1912 if (opt & OPT_SETUID) { 1925 if (opt & OPT_SETUID) {
1913 char *e; 1926 if (!get_uidgid(&ugid, s_ugid, 1))
1914 // FIXME: what the default group should be? 1927 bb_error_msg_and_die("unrecognized user[:group] "
1915 ugid.gid = -1;
1916 ugid.uid = bb_strtoul(s_ugid, &e, 0);
1917 if (*e == ':') {
1918 e++;
1919 ugid.gid = bb_strtoul(e, NULL, 0);
1920 }
1921 if (errno) {
1922 /* not integer */
1923 if (!uidgid_get(&ugid, s_ugid))
1924 bb_error_msg_and_die("unrecognized user[:group] "
1925 "name '%s'", s_ugid); 1928 "name '%s'", s_ugid);
1926 }
1927 } 1929 }
1928#endif 1930#endif
1929 1931