summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko2008-07-20 23:25:32 +0000
committerDenis Vlasenko2008-07-20 23:25:32 +0000
commit395410b748e0ca0a673da4d288cbf89f6cff3c93 (patch)
tree5855e69a4a408c4701888e6d93bb56ff54403be3
parent7ae1cc16b4ecec930cd776f9ed688b6d4d53a166 (diff)
downloadbusybox-395410b748e0ca0a673da4d288cbf89f6cff3c93.zip
busybox-395410b748e0ca0a673da4d288cbf89f6cff3c93.tar.gz
httpd: add Hopedir directive specially for
(and by) walter harms <wharms AT bfs.de>; fix silly double-parse bug added in 21412. function old new delta parse_conf 1532 1576 +44
-rw-r--r--networking/httpd.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/networking/httpd.c b/networking/httpd.c
index 30ef305..66c6982 100644
--- a/networking/httpd.c
+++ b/networking/httpd.c
@@ -37,6 +37,7 @@
*
* httpd.conf has the following format:
*
+ * H:/serverroot # define the server root. It will override -h
* A:172.20. # Allow address from 172.20.0.0/16
* A:10.0.0.0/25 # Allow any address from 10.0.0.0-10.0.0.127
* A:10.0.0.0/255.255.255.128 # Allow any address that previous set
@@ -687,6 +688,13 @@ static void parse_conf(const char *path, int flag)
continue;
}
+ /* Do not allow jumping around using H in subdir's configs */
+ if (flag == FIRST_PARSE && *p0 == 'H') {
+ home_httpd = xstrdup(after_colon);
+ xchdir(home_httpd);
+ continue;
+ }
+
#if ENABLE_FEATURE_HTTPD_BASIC_AUTH \
|| ENABLE_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES \
|| ENABLE_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR
@@ -2256,8 +2264,7 @@ static void mini_httpd_inetd(void)
#if ENABLE_FEATURE_HTTPD_RELOAD_CONFIG_SIGHUP
static void sighup_handler(int sig)
{
- parse_conf(default_path_httpd_conf, sig == SIGHUP ? SIGNALED_PARSE : FIRST_PARSE);
-
+ parse_conf(default_path_httpd_conf, sig ? SIGNALED_PARSE : FIRST_PARSE);
signal_SA_RESTART_empty_mask(SIGHUP, sighup_handler);
}
#endif
@@ -2392,10 +2399,14 @@ int httpd_main(int argc UNUSED_PARAM, char **argv)
#endif
#if ENABLE_FEATURE_HTTPD_RELOAD_CONFIG_SIGHUP
- if (!(opt & OPT_INETD))
+ if (!(opt & OPT_INETD)) {
+ /* runs parse_conf() inside */
sighup_handler(0);
+ } else
#endif
- parse_conf(default_path_httpd_conf, FIRST_PARSE);
+ {
+ parse_conf(default_path_httpd_conf, FIRST_PARSE);
+ }
xfunc_error_retval = 0;
if (opt & OPT_INETD)