mirror of
https://github.com/sheumann/hush.git
synced 2024-12-28 07:30:23 +00:00
Three patches from FreeWRT people
This commit is contained in:
parent
e8feca085d
commit
6cd84dac84
@ -296,7 +296,9 @@ static void EditFile(const char *user, const char *file)
|
|||||||
if (ChangeUser(user, 1) < 0)
|
if (ChangeUser(user, 1) < 0)
|
||||||
exit(0);
|
exit(0);
|
||||||
ptr = getenv("VISUAL");
|
ptr = getenv("VISUAL");
|
||||||
if (ptr == NULL || strlen(ptr) > 256)
|
if (ptr == NULL)
|
||||||
|
ptr = getenv("EDITOR");
|
||||||
|
if (ptr == NULL)
|
||||||
ptr = PATH_VI;
|
ptr = PATH_VI;
|
||||||
|
|
||||||
ptr = xasprintf("%s %s", ptr, file);
|
ptr = xasprintf("%s %s", ptr, file);
|
||||||
|
@ -145,6 +145,7 @@ struct globals {
|
|||||||
USE_FEATURE_HTTPD_BASIC_AUTH(const char *g_realm;)
|
USE_FEATURE_HTTPD_BASIC_AUTH(const char *g_realm;)
|
||||||
USE_FEATURE_HTTPD_BASIC_AUTH(char *remoteuser;)
|
USE_FEATURE_HTTPD_BASIC_AUTH(char *remoteuser;)
|
||||||
USE_FEATURE_HTTPD_CGI(char *referer;)
|
USE_FEATURE_HTTPD_CGI(char *referer;)
|
||||||
|
USE_FEATURE_HTTPD_CGI(char *user_agent;)
|
||||||
|
|
||||||
#if ENABLE_FEATURE_HTTPD_CGI || DEBUG
|
#if ENABLE_FEATURE_HTTPD_CGI || DEBUG
|
||||||
char *rmt_ip_str; /* for set env REMOTE_ADDR */
|
char *rmt_ip_str; /* for set env REMOTE_ADDR */
|
||||||
@ -179,6 +180,7 @@ struct globals {
|
|||||||
#define g_realm (G.g_realm )
|
#define g_realm (G.g_realm )
|
||||||
#define remoteuser (G.remoteuser )
|
#define remoteuser (G.remoteuser )
|
||||||
#define referer (G.referer )
|
#define referer (G.referer )
|
||||||
|
#define user_agent (G.user_agent )
|
||||||
#if ENABLE_FEATURE_HTTPD_CGI || DEBUG
|
#if ENABLE_FEATURE_HTTPD_CGI || DEBUG
|
||||||
#define rmt_ip_str (G.rmt_ip_str )
|
#define rmt_ip_str (G.rmt_ip_str )
|
||||||
#endif
|
#endif
|
||||||
@ -1106,6 +1108,7 @@ static int sendCgi(const char *url,
|
|||||||
setenv1("REMOTE_ADDR", p);
|
setenv1("REMOTE_ADDR", p);
|
||||||
if (cp) *cp = ':';
|
if (cp) *cp = ':';
|
||||||
}
|
}
|
||||||
|
setenv1("HTTP_USER_AGENT", user_agent);
|
||||||
#if ENABLE_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV
|
#if ENABLE_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV
|
||||||
setenv_long("REMOTE_PORT", tcp_port);
|
setenv_long("REMOTE_PORT", tcp_port);
|
||||||
#endif
|
#endif
|
||||||
@ -1682,12 +1685,14 @@ static void handleIncoming(void)
|
|||||||
if (test[0] || errno || length > INT_MAX)
|
if (test[0] || errno || length > INT_MAX)
|
||||||
goto bail_out;
|
goto bail_out;
|
||||||
}
|
}
|
||||||
} else if ((STRNCASECMP(buf, "Cookie:") == 0)) {
|
} else if (STRNCASECMP(buf, "Cookie:") == 0) {
|
||||||
cookie = strdup(skip_whitespace(buf + sizeof("Cookie:")-1));
|
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));
|
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));
|
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
|
#endif
|
||||||
|
|
||||||
|
@ -484,7 +484,12 @@ static const struct dhcp_client_t ext_dhcp_clients[] = {
|
|||||||
static int dhcp_up(struct interface_defn_t *ifd, execfn *exec)
|
static int dhcp_up(struct interface_defn_t *ifd, execfn *exec)
|
||||||
{
|
{
|
||||||
#if ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCP
|
#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++) {
|
for (i = 0; i < ARRAY_SIZE(ext_dhcp_clients); i++) {
|
||||||
if (exists_execable(ext_dhcp_clients[i].name))
|
if (exists_execable(ext_dhcp_clients[i].name))
|
||||||
return execute(ext_dhcp_clients[i].startcmd, ifd, exec);
|
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");
|
bb_error_msg("no dhcp clients found");
|
||||||
return 0;
|
return 0;
|
||||||
#elif ENABLE_APP_UDHCPC
|
#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 "
|
return execute("udhcpc -R -n -p /var/run/udhcpc.%iface%.pid "
|
||||||
"-i %iface%[[ -H %hostname%]][[ -c %clientid%]][[ -s %script%]]",
|
"-i %iface%[[ -H %hostname%]][[ -c %clientid%]][[ -s %script%]]",
|
||||||
ifd, exec);
|
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)
|
static int dhcp_down(struct interface_defn_t *ifd, execfn *exec)
|
||||||
{
|
{
|
||||||
#if ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCP
|
#if ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCP
|
||||||
int i ;
|
int i;
|
||||||
for (i = 0; i < ARRAY_SIZE(ext_dhcp_clients); i++) {
|
for (i = 0; i < ARRAY_SIZE(ext_dhcp_clients); i++) {
|
||||||
if (exists_execable(ext_dhcp_clients[i].name))
|
if (exists_execable(ext_dhcp_clients[i].name))
|
||||||
return execute(ext_dhcp_clients[i].stopcmd, ifd, exec);
|
return execute(ext_dhcp_clients[i].stopcmd, ifd, exec);
|
||||||
|
Loading…
Reference in New Issue
Block a user