svn commit: trunk/busybox: miscutils networking

vda at busybox.net vda at busybox.net
Sat Jul 21 14:57:56 UTC 2007


Author: vda
Date: 2007-07-21 07:57:54 -0700 (Sat, 21 Jul 2007)
New Revision: 19189

Log:
Three patches from FreeWRT people



Modified:
   trunk/busybox/miscutils/crontab.c
   trunk/busybox/networking/httpd.c
   trunk/busybox/networking/ifupdown.c


Changeset:
Modified: trunk/busybox/miscutils/crontab.c
===================================================================
--- trunk/busybox/miscutils/crontab.c	2007-07-21 13:54:26 UTC (rev 19188)
+++ trunk/busybox/miscutils/crontab.c	2007-07-21 14:57:54 UTC (rev 19189)
@@ -296,7 +296,9 @@
 		if (ChangeUser(user, 1) < 0)
 			exit(0);
 		ptr = getenv("VISUAL");
-		if (ptr == NULL || strlen(ptr) > 256)
+		if (ptr == NULL)
+			ptr = getenv("EDITOR");
+		if (ptr == NULL)
 			ptr = PATH_VI;
 
 		ptr = xasprintf("%s %s", ptr, file);

Modified: trunk/busybox/networking/httpd.c
===================================================================
--- trunk/busybox/networking/httpd.c	2007-07-21 13:54:26 UTC (rev 19188)
+++ trunk/busybox/networking/httpd.c	2007-07-21 14:57:54 UTC (rev 19189)
@@ -145,6 +145,7 @@
 	USE_FEATURE_HTTPD_BASIC_AUTH(const char *g_realm;)
 	USE_FEATURE_HTTPD_BASIC_AUTH(char *remoteuser;)
 	USE_FEATURE_HTTPD_CGI(char *referer;)
+	USE_FEATURE_HTTPD_CGI(char *user_agent;)
 
 #if ENABLE_FEATURE_HTTPD_CGI || DEBUG
 	char *rmt_ip_str;        /* for set env REMOTE_ADDR */
@@ -179,6 +180,7 @@
 #define g_realm         (G.g_realm        )
 #define remoteuser      (G.remoteuser     )
 #define referer         (G.referer        )
+#define user_agent      (G.user_agent     )
 #if ENABLE_FEATURE_HTTPD_CGI || DEBUG
 #define rmt_ip_str      (G.rmt_ip_str     )
 #endif
@@ -1106,6 +1108,7 @@
 			setenv1("REMOTE_ADDR", p);
 			if (cp) *cp = ':';
 		}
+ 		setenv1("HTTP_USER_AGENT", user_agent);
 #if ENABLE_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV
 		setenv_long("REMOTE_PORT", tcp_port);
 #endif
@@ -1682,12 +1685,14 @@
 						if (test[0] || errno || length > INT_MAX)
 							goto bail_out;
 					}
-				} else if ((STRNCASECMP(buf, "Cookie:") == 0)) {
+				} else if (STRNCASECMP(buf, "Cookie:") == 0) {
 					cookie = strdup(skip_whitespace(buf + sizeof("Cookie:")-1));
-				} else if ((STRNCASECMP(buf, "Content-Type:") == 0)) {
+				} else if (STRNCASECMP(buf, "Content-Type:") == 0)) {
 					content_type = strdup(skip_whitespace(buf + sizeof("Content-Type:")-1));
-				} else if ((STRNCASECMP(buf, "Referer:") == 0)) {
+				} else if (STRNCASECMP(buf, "Referer:") == 0) {
 					referer = strdup(skip_whitespace(buf + sizeof("Referer:")-1));
+				} else if (STRNCASECMP(buf, "User-Agent:") == 0) {
+					user_agent = strdup(skip_whitespace(buf + sizeof("User-Agent:")-1));
 				}
 #endif
 

Modified: trunk/busybox/networking/ifupdown.c
===================================================================
--- trunk/busybox/networking/ifupdown.c	2007-07-21 13:54:26 UTC (rev 19188)
+++ trunk/busybox/networking/ifupdown.c	2007-07-21 14:57:54 UTC (rev 19189)
@@ -484,7 +484,12 @@
 static int dhcp_up(struct interface_defn_t *ifd, execfn *exec)
 {
 #if ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCP
-	int i ;
+#if ENABLE_FEATURE_IFUPDOWN_IP
+	/* ip doesn't up iface when it configures it (unlike ifconfig) */
+	if (!execute("ip link set %iface% up", ifd, exec))
+		return 0;
+#endif
+	int i;
 	for (i = 0; i < ARRAY_SIZE(ext_dhcp_clients); i++) {
 		if (exists_execable(ext_dhcp_clients[i].name))
 			return execute(ext_dhcp_clients[i].startcmd, ifd, exec);
@@ -492,6 +497,11 @@
 	bb_error_msg("no dhcp clients found");
 	return 0;
 #elif ENABLE_APP_UDHCPC
+#if ENABLE_FEATURE_IFUPDOWN_IP
+	/* ip doesn't up iface when it configures it (unlike ifconfig) */
+	if (!execute("ip link set %iface% up", ifd, exec))
+		return 0;
+#endif
 	return execute("udhcpc -R -n -p /var/run/udhcpc.%iface%.pid "
 			"-i %iface%[[ -H %hostname%]][[ -c %clientid%]][[ -s %script%]]",
 			ifd, exec);
@@ -503,7 +513,7 @@
 static int dhcp_down(struct interface_defn_t *ifd, execfn *exec)
 {
 #if ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCP
-	int i ;
+	int i;
 	for (i = 0; i < ARRAY_SIZE(ext_dhcp_clients); i++) {
 		if (exists_execable(ext_dhcp_clients[i].name))
 			return execute(ext_dhcp_clients[i].stopcmd, ifd, exec);




More information about the busybox-cvs mailing list