[BusyBox-cvs] busybox/networking Config.in,1.14,1.15 httpd.c,1.7,1.8 ifconfig.c,1.23,1.24

Glenn McGrath bug1 at busybox.net
Mon May 26 14:06:05 UTC 2003


Update of /var/cvs/busybox/networking
In directory winder:/tmp/cvs-serv10512/networking

Modified Files:
	Config.in httpd.c ifconfig.c 
Log Message:
Vodz, last_patch_86


Index: Config.in
===================================================================
RCS file: /var/cvs/busybox/networking/Config.in,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- Config.in	14 May 2003 12:20:21 -0000	1.14
+++ Config.in	26 May 2003 14:06:01 -0000	1.15
@@ -58,6 +58,7 @@
 	  authentication on a per url basis.
 
 
+if !CONFIG_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY
 config CONFIG_FEATURE_HTTPD_RELOAD_CONFIG_SIGHUP
 	bool "  Enable support reload global config file after hup signaled"
 	default n
@@ -75,6 +76,7 @@
 	  rather than defaulting to the user that starts the server.
 	  Use of this option requires special privilegies to change to a
 	  different user.
+endif
 
 config CONFIG_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES
 	bool "  Enable support load from config file mime types"
@@ -91,6 +93,7 @@
 	help
 	  This option allows scripts and executables to be invoked
   	  when specific urls are requested.
+
 config CONFIG_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV
 	bool "  Enable support set eviroment REMOTE_PORT variable for CGI"
 	default n
@@ -111,15 +114,6 @@
 	  to 'bar'.  In addition, this option sets a variable that
 	  lists all the argument names.  e.g. CGI_VARNAMES_="name1 name2".
 
-config CONFIG_FEATURE_HTTPD_DECODE_URL_STR
-	bool "  Enable the -d option for shell script CGI simplification"
-	default y
-	depends on CONFIG_HTTPD
-	help
-	  After set,  this option enables support for decoding of
-	  url-encoded form arguments via the -d option.  Output goes to
-	  stdout. For example, httpd -d "Hello%20World" produces "Hello World".
-
 config CONFIG_FEATURE_HTTPD_ENCODE_URL_STR
 	bool "  Enable the -e option for shell script CGI simplification."
 	default y
@@ -474,7 +468,7 @@
 
 config CONFIG_FEATURE_TFTP_DEBUG
 	bool "  Enable debug"
-	default y
+	default n
 	depends on CONFIG_TFTP
 	help
 	  Please submit a patch to add help text for this item.
@@ -487,14 +481,14 @@
 
 config CONFIG_FEATURE_TRACEROUTE_VERBOSE
 	bool "  Enable verbose output"
-	default y
+	default n
 	depends on CONFIG_TRACEROUTE
 	help
 	  Please submit a patch to add help text for this item.
 
 config CONFIG_FEATURE_TRACEROUTE_SO_DEBUG
 	bool "  Enable SO_DEBUG option"
-	default y
+	default n
 	depends on CONFIG_TRACEROUTE
 	help
 	  Please submit a patch to add help text for this item.

Index: httpd.c
===================================================================
RCS file: /var/cvs/busybox/networking/httpd.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- httpd.c	19 May 2003 05:56:16 -0000	1.7
+++ httpd.c	26 May 2003 14:06:01 -0000	1.8
@@ -60,8 +60,7 @@
  * .au:audio/basic   # additional mime type for audio.au files
  * 
  * A/D may be as a/d or allow/deny - first char case unsensitive
- * Deny IP rules take precedence over allow rules.  Any IP rules after D:* are
- * ignored.
+ * Deny IP rules take precedence over allow rules.
  * 
  * 
  * The Deny/Allow IP logic:
@@ -123,7 +122,7 @@
 #include "busybox.h"
 
 
-static const char httpdVersion[] = "busybox httpd/1.26 18-May-2003";
+static const char httpdVersion[] = "busybox httpd/1.27 25-May-2003";
 static const char default_path_httpd_conf[] = "/etc";
 static const char httpd_conf[] = "httpd.conf";
 static const char home[] = "./";
@@ -234,6 +233,7 @@
   time_t last_mod;
 
   Htaccess *ip_a_d;             /* config allow/deny lines */
+  int flg_deny_all;
 #ifdef CONFIG_FEATURE_HTTPD_BASIC_AUTH
   Htaccess *auth;               /* config user:password lines */
 #endif
@@ -452,16 +452,21 @@
 	/* test for empty or strange line */
 	if (c == NULL || *c == 0)
 	    continue;
-	if(*c == '*')
-	    *c = 0;   /* Allow all */
 	p0 = buf;
-	if((*p0 == 'i') || (*p0 == 'I'))
-		*p0 = 'A'; // version 1.1/1.2 compatibility for ip:
-	if(*p0 == 'a')
-	    *p0 = 'A';
 	if(*p0 == 'd')
 	    *p0 = 'D';
-	if(*p0 != 'A' && *p0 != 'D'
+	if(*c == '*') {
+	    if(*p0 == 'D') {
+		/* memorize deny all */
+		config->flg_deny_all++;
+	    }
+	    /* skip default other "word:*" config lines */
+	    continue;
+	}
+
+	if(*p0 == 'a')
+	    *p0 = 'A';
+	else if(*p0 != 'D'
 #ifdef CONFIG_FEATURE_HTTPD_BASIC_AUTH
 	   && *p0 != '/'
 #endif
@@ -471,17 +476,8 @@
 	  )
 	       continue;
 
-	if(*p0 == 'A' && *c == 0) {
-	    /* skip default A:* */
-	    continue;
-	}
-	p0 = buf;
 #ifdef CONFIG_FEATURE_HTTPD_BASIC_AUTH
 	if(*p0 == '/') {
-	    if(*c == 0) {
-		/* skip /path:* */
-		continue;
-	    }
 	    /* make full path from httpd root / curent_path / config_line_path */
 	    cf = flag == SUBDIR_PARSE ? path : "";
 	    p0 = malloc(strlen(cf) + (c - buf) + 2 + strlen(c));
@@ -532,12 +528,12 @@
 		free(p0);
 #endif
 	    if(*cf == 'A' || *cf == 'D') {
-		if(*cf == 'D' && *c) {
+		if(*cf == 'D') {
 			/* Deny:form_IP move top */
 			cur->next = config->ip_a_d;
 			config->ip_a_d = cur;
 		} else {
-			/* add to bottom current IP config line */
+			/* add to bottom A:form_IP config line */
 			Htaccess *prev_IP = config->ip_a_d;
 
 			if(prev_IP == NULL) {
@@ -573,12 +569,11 @@
 			cur->next = hti;
 			if(prev_hti != hti) {
 			    prev_hti->next = cur;
-			    break;
 			} else {
 			    /* insert as top */
 			    config->auth = cur;
-			    break;
 			}
+			break;
 		    }
 		    if(prev_hti != hti)
 			    prev_hti = prev_hti->next;
@@ -695,18 +690,16 @@
 			const char *name_after_underline, const char *value)
 {
   char *s;
+  const char *underline;
 
   if (config->envCount >= ENVSIZE)
 	return;
   if (!value)
 	value = "";
-  s = malloc(strlen(name_before_underline) + strlen(name_after_underline) +
-			strlen(value) + 3);
-  if (s) {
-    const char *underline = *name_after_underline ? "_" : "";
-
-    sprintf(s,"%s%s%s=%s", name_before_underline, underline,
+  underline = *name_after_underline ? "_" : "";
+  asprintf(&s, "%s%s%s=%s", name_before_underline, underline,
 					name_after_underline, value);
+  if(s) {
     config->envp[config->envCount++] = s;
     config->envp[config->envCount] = 0;
   }
@@ -764,11 +757,11 @@
 	*args++ = 0;
     addEnv("CGI", name, decodeString(value, 1));
     if (*namelist) strcat(namelist, " ");
-    strcat(namelist,name);
+    strcat(namelist, name);
   }
   free(memargs);
   if (namelist) {
-    addEnv("CGI","ARGLIST_",namelist);
+    addEnv("CGI", "ARGLIST_", namelist);
     free(namelist);
   }
 }
@@ -1337,6 +1330,8 @@
 	}
     }   /* for */
 
+    if(ipaddr)
+	return config->flg_deny_all;
     return prev == NULL;
 }
 
@@ -1359,7 +1354,7 @@
     }
 
     /* if uncofigured, return 1 - access from all */
-    return 1;
+    return config->flg_deny_all;
 }
 #define checkPerm(null, request) checkPermIP(request)
 #endif  /* CONFIG_FEATURE_HTTPD_BASIC_AUTH */
@@ -1788,9 +1783,7 @@
       config->debugHttpd = 1;
       break;
     case 'p':
-      config->port = atoi(optarg);
-      if(config->port <= 0 || config->port > 0xffff)
-	bb_error_msg_and_die("invalid %s for -p", optarg);
+      config->port = bb_xgetlarg(optarg, 10, 1, 0xffff);
       break;
 #endif
     case 'd':
@@ -1854,10 +1847,11 @@
 #ifdef TEST
   if (numTestArgs)
   {
-	  if (strcmp(testArgs[0],"ip") == 0) testArgs[0] = 0;
+	  int result;
+	  if (strcmp(testArgs[0], "ip") == 0) testArgs[0] = 0;
 	  if (numTestArgs > 2)
 	    parse_conf(testArgs[2], SUBDIR_PARSE);
-	  int result = printf("%d\n",checkPerm(testArgs[0],testArgs[1]));
+	  result = printf("%d\n", checkPerm(testArgs[0], testArgs[1]));
 	  return result;
   }
 #endif

Index: ifconfig.c
===================================================================
RCS file: /var/cvs/busybox/networking/ifconfig.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- ifconfig.c	19 Mar 2003 09:12:38 -0000	1.23
+++ ifconfig.c	26 May 2003 14:06:01 -0000	1.24
@@ -296,7 +296,7 @@
 #ifdef CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS
 	unsigned int mask;
 	unsigned int did_flags;
-	in_addr_t sai_hostname, sai_netmask;
+	unsigned int sai_hostname, sai_netmask;
 #else
 	unsigned char mask;
 	unsigned char did_flags;



More information about the busybox-cvs mailing list