summaryrefslogtreecommitdiffstats
path: root/usr.sbin/nginx/src/http
diff options
context:
space:
mode:
authorrobert <robert@openbsd.org>2011-10-11 22:53:00 +0000
committerrobert <robert@openbsd.org>2011-10-11 22:53:00 +0000
commitc730dea46d0ea6934895cf88c5445d63f180838c (patch)
tree1b1204dcea98747b9ea3fe1fff7fb561bc87da41 /usr.sbin/nginx/src/http
parentUpdate Digest module to 1.17 (security fix). (diff)
downloadwireguard-openbsd-c730dea46d0ea6934895cf88c5445d63f180838c.tar.xz
wireguard-openbsd-c730dea46d0ea6934895cf88c5445d63f180838c.zip
Add a flag for nginx (-u) to be able to disable chroot and use a better
method for modifying the document root if chrooted, so currently this allows the user to run the same configuration file with a chrooted and an non-chrooted setup.
Diffstat (limited to 'usr.sbin/nginx/src/http')
-rw-r--r--usr.sbin/nginx/src/http/ngx_http_core_module.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/usr.sbin/nginx/src/http/ngx_http_core_module.c b/usr.sbin/nginx/src/http/ngx_http_core_module.c
index cd4ed2cacb3..f65dd2f1244 100644
--- a/usr.sbin/nginx/src/http/ngx_http_core_module.c
+++ b/usr.sbin/nginx/src/http/ngx_http_core_module.c
@@ -3338,6 +3338,7 @@ ngx_http_core_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
{
ngx_http_core_loc_conf_t *prev = parent;
ngx_http_core_loc_conf_t *conf = child;
+ char *buf;
ngx_uint_t i;
ngx_hash_key_t *type;
@@ -3357,6 +3358,14 @@ ngx_http_core_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
return NGX_CONF_ERROR;
}
}
+
+ if (ngx_chrooted) {
+ buf = malloc(conf->root.len);
+ ngx_cpystrn(buf, conf->root.data + strlen(NGX_PREFIX) - 1,
+ conf->root.len);
+ ngx_str_set(&conf->root, buf);
+ free(buf);
+ }
}
if (conf->post_action.data == NULL) {