diff options
author | Denis Vlasenko | 2007-07-21 14:57:54 +0000 |
---|---|---|
committer | Denis Vlasenko | 2007-07-21 14:57:54 +0000 |
commit | 6cd84dac84f72dde437790cc620c8638d3591d00 (patch) | |
tree | 1c822ba1859d04ab9af79210d7f331207738ed7b | |
parent | e8feca085dbcd0fb97aa5af1a8e751affb88df48 (diff) | |
download | busybox-6cd84dac84f72dde437790cc620c8638d3591d00.zip busybox-6cd84dac84f72dde437790cc620c8638d3591d00.tar.gz |
Three patches from FreeWRT people
-rw-r--r-- | miscutils/crontab.c | 4 | ||||
-rw-r--r-- | networking/httpd.c | 11 | ||||
-rw-r--r-- | networking/ifupdown.c | 14 |
3 files changed, 23 insertions, 6 deletions
diff --git a/miscutils/crontab.c b/miscutils/crontab.c index 76c382e..69f2e31 100644 --- a/miscutils/crontab.c +++ b/miscutils/crontab.c @@ -296,7 +296,9 @@ static void EditFile(const char *user, const char *file) 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); diff --git a/networking/httpd.c b/networking/httpd.c index 8c5e29f..d058812 100644 --- a/networking/httpd.c +++ b/networking/httpd.c @@ -145,6 +145,7 @@ struct globals { 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 @@ struct globals { #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 @@ static int sendCgi(const char *url, 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 @@ static void handleIncoming(void) 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 diff --git a/networking/ifupdown.c b/networking/ifupdown.c index 5aa3fa5..a15e141 100644 --- a/networking/ifupdown.c +++ b/networking/ifupdown.c @@ -484,7 +484,12 @@ static const struct dhcp_client_t ext_dhcp_clients[] = { 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 @@ static int dhcp_up(struct interface_defn_t *ifd, execfn *exec) 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_up(struct interface_defn_t *ifd, execfn *exec) 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); |