From 395410b748e0ca0a673da4d288cbf89f6cff3c93 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Sun, 20 Jul 2008 23:25:32 +0000 Subject: httpd: add Hopedir directive specially for (and by) walter harms ; fix silly double-parse bug added in 21412. function old new delta parse_conf 1532 1576 +44 --- networking/httpd.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'networking') diff --git a/networking/httpd.c b/networking/httpd.c index 30ef30552..66c6982bc 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) -- cgit v1.2.3