diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-07-21 14:57:54 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-07-21 14:57:54 +0000 |
commit | 6cd84dac84f72dde437790cc620c8638d3591d00 (patch) | |
tree | 1c822ba1859d04ab9af79210d7f331207738ed7b | |
parent | e8feca085dbcd0fb97aa5af1a8e751affb88df48 (diff) | |
download | busybox-w32-6cd84dac84f72dde437790cc620c8638d3591d00.tar.gz busybox-w32-6cd84dac84f72dde437790cc620c8638d3591d00.tar.bz2 busybox-w32-6cd84dac84f72dde437790cc620c8638d3591d00.zip |
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 76c382e8f..69f2e3123 100644 --- a/miscutils/crontab.c +++ b/miscutils/crontab.c | |||
@@ -296,7 +296,9 @@ static void EditFile(const char *user, const char *file) | |||
296 | if (ChangeUser(user, 1) < 0) | 296 | if (ChangeUser(user, 1) < 0) |
297 | exit(0); | 297 | exit(0); |
298 | ptr = getenv("VISUAL"); | 298 | ptr = getenv("VISUAL"); |
299 | if (ptr == NULL || strlen(ptr) > 256) | 299 | if (ptr == NULL) |
300 | ptr = getenv("EDITOR"); | ||
301 | if (ptr == NULL) | ||
300 | ptr = PATH_VI; | 302 | ptr = PATH_VI; |
301 | 303 | ||
302 | ptr = xasprintf("%s %s", ptr, file); | 304 | ptr = xasprintf("%s %s", ptr, file); |
diff --git a/networking/httpd.c b/networking/httpd.c index 8c5e29fa8..d058812fc 100644 --- a/networking/httpd.c +++ b/networking/httpd.c | |||
@@ -145,6 +145,7 @@ struct globals { | |||
145 | USE_FEATURE_HTTPD_BASIC_AUTH(const char *g_realm;) | 145 | USE_FEATURE_HTTPD_BASIC_AUTH(const char *g_realm;) |
146 | USE_FEATURE_HTTPD_BASIC_AUTH(char *remoteuser;) | 146 | USE_FEATURE_HTTPD_BASIC_AUTH(char *remoteuser;) |
147 | USE_FEATURE_HTTPD_CGI(char *referer;) | 147 | USE_FEATURE_HTTPD_CGI(char *referer;) |
148 | USE_FEATURE_HTTPD_CGI(char *user_agent;) | ||
148 | 149 | ||
149 | #if ENABLE_FEATURE_HTTPD_CGI || DEBUG | 150 | #if ENABLE_FEATURE_HTTPD_CGI || DEBUG |
150 | char *rmt_ip_str; /* for set env REMOTE_ADDR */ | 151 | char *rmt_ip_str; /* for set env REMOTE_ADDR */ |
@@ -179,6 +180,7 @@ struct globals { | |||
179 | #define g_realm (G.g_realm ) | 180 | #define g_realm (G.g_realm ) |
180 | #define remoteuser (G.remoteuser ) | 181 | #define remoteuser (G.remoteuser ) |
181 | #define referer (G.referer ) | 182 | #define referer (G.referer ) |
183 | #define user_agent (G.user_agent ) | ||
182 | #if ENABLE_FEATURE_HTTPD_CGI || DEBUG | 184 | #if ENABLE_FEATURE_HTTPD_CGI || DEBUG |
183 | #define rmt_ip_str (G.rmt_ip_str ) | 185 | #define rmt_ip_str (G.rmt_ip_str ) |
184 | #endif | 186 | #endif |
@@ -1106,6 +1108,7 @@ static int sendCgi(const char *url, | |||
1106 | setenv1("REMOTE_ADDR", p); | 1108 | setenv1("REMOTE_ADDR", p); |
1107 | if (cp) *cp = ':'; | 1109 | if (cp) *cp = ':'; |
1108 | } | 1110 | } |
1111 | setenv1("HTTP_USER_AGENT", user_agent); | ||
1109 | #if ENABLE_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV | 1112 | #if ENABLE_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV |
1110 | setenv_long("REMOTE_PORT", tcp_port); | 1113 | setenv_long("REMOTE_PORT", tcp_port); |
1111 | #endif | 1114 | #endif |
@@ -1682,12 +1685,14 @@ static void handleIncoming(void) | |||
1682 | if (test[0] || errno || length > INT_MAX) | 1685 | if (test[0] || errno || length > INT_MAX) |
1683 | goto bail_out; | 1686 | goto bail_out; |
1684 | } | 1687 | } |
1685 | } else if ((STRNCASECMP(buf, "Cookie:") == 0)) { | 1688 | } else if (STRNCASECMP(buf, "Cookie:") == 0) { |
1686 | cookie = strdup(skip_whitespace(buf + sizeof("Cookie:")-1)); | 1689 | cookie = strdup(skip_whitespace(buf + sizeof("Cookie:")-1)); |
1687 | } else if ((STRNCASECMP(buf, "Content-Type:") == 0)) { | 1690 | } else if (STRNCASECMP(buf, "Content-Type:") == 0)) { |
1688 | content_type = strdup(skip_whitespace(buf + sizeof("Content-Type:")-1)); | 1691 | content_type = strdup(skip_whitespace(buf + sizeof("Content-Type:")-1)); |
1689 | } else if ((STRNCASECMP(buf, "Referer:") == 0)) { | 1692 | } else if (STRNCASECMP(buf, "Referer:") == 0) { |
1690 | referer = strdup(skip_whitespace(buf + sizeof("Referer:")-1)); | 1693 | referer = strdup(skip_whitespace(buf + sizeof("Referer:")-1)); |
1694 | } else if (STRNCASECMP(buf, "User-Agent:") == 0) { | ||
1695 | user_agent = strdup(skip_whitespace(buf + sizeof("User-Agent:")-1)); | ||
1691 | } | 1696 | } |
1692 | #endif | 1697 | #endif |
1693 | 1698 | ||
diff --git a/networking/ifupdown.c b/networking/ifupdown.c index 5aa3fa5f1..a15e1411e 100644 --- a/networking/ifupdown.c +++ b/networking/ifupdown.c | |||
@@ -484,7 +484,12 @@ static const struct dhcp_client_t ext_dhcp_clients[] = { | |||
484 | static int dhcp_up(struct interface_defn_t *ifd, execfn *exec) | 484 | static int dhcp_up(struct interface_defn_t *ifd, execfn *exec) |
485 | { | 485 | { |
486 | #if ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCP | 486 | #if ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCP |
487 | int i ; | 487 | #if ENABLE_FEATURE_IFUPDOWN_IP |
488 | /* ip doesn't up iface when it configures it (unlike ifconfig) */ | ||
489 | if (!execute("ip link set %iface% up", ifd, exec)) | ||
490 | return 0; | ||
491 | #endif | ||
492 | int i; | ||
488 | for (i = 0; i < ARRAY_SIZE(ext_dhcp_clients); i++) { | 493 | for (i = 0; i < ARRAY_SIZE(ext_dhcp_clients); i++) { |
489 | if (exists_execable(ext_dhcp_clients[i].name)) | 494 | if (exists_execable(ext_dhcp_clients[i].name)) |
490 | return execute(ext_dhcp_clients[i].startcmd, ifd, exec); | 495 | return execute(ext_dhcp_clients[i].startcmd, ifd, exec); |
@@ -492,6 +497,11 @@ static int dhcp_up(struct interface_defn_t *ifd, execfn *exec) | |||
492 | bb_error_msg("no dhcp clients found"); | 497 | bb_error_msg("no dhcp clients found"); |
493 | return 0; | 498 | return 0; |
494 | #elif ENABLE_APP_UDHCPC | 499 | #elif ENABLE_APP_UDHCPC |
500 | #if ENABLE_FEATURE_IFUPDOWN_IP | ||
501 | /* ip doesn't up iface when it configures it (unlike ifconfig) */ | ||
502 | if (!execute("ip link set %iface% up", ifd, exec)) | ||
503 | return 0; | ||
504 | #endif | ||
495 | return execute("udhcpc -R -n -p /var/run/udhcpc.%iface%.pid " | 505 | return execute("udhcpc -R -n -p /var/run/udhcpc.%iface%.pid " |
496 | "-i %iface%[[ -H %hostname%]][[ -c %clientid%]][[ -s %script%]]", | 506 | "-i %iface%[[ -H %hostname%]][[ -c %clientid%]][[ -s %script%]]", |
497 | ifd, exec); | 507 | ifd, exec); |
@@ -503,7 +513,7 @@ static int dhcp_up(struct interface_defn_t *ifd, execfn *exec) | |||
503 | static int dhcp_down(struct interface_defn_t *ifd, execfn *exec) | 513 | static int dhcp_down(struct interface_defn_t *ifd, execfn *exec) |
504 | { | 514 | { |
505 | #if ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCP | 515 | #if ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCP |
506 | int i ; | 516 | int i; |
507 | for (i = 0; i < ARRAY_SIZE(ext_dhcp_clients); i++) { | 517 | for (i = 0; i < ARRAY_SIZE(ext_dhcp_clients); i++) { |
508 | if (exists_execable(ext_dhcp_clients[i].name)) | 518 | if (exists_execable(ext_dhcp_clients[i].name)) |
509 | return execute(ext_dhcp_clients[i].stopcmd, ifd, exec); | 519 | return execute(ext_dhcp_clients[i].stopcmd, ifd, exec); |