summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstbuehler <stbuehler@152afb58-edef-0310-8abb-c4023f1b3aa9>2013-08-30 13:14:59 +0000
committerstbuehler <stbuehler@152afb58-edef-0310-8abb-c4023f1b3aa9>2013-08-30 13:14:59 +0000
commitb0833507c4b9dba740793920decf635cd660b987 (patch)
tree4e265e61f7a71eafce2d1f782c515ac15a18498e
parentc895a58ebfb534a93dc78c47118fb4c2c8ea68e5 (diff)
downloadlighttpd-b0833507c4b9dba740793920decf635cd660b987.tar.gz
[core] check whether server.chroot exists
From: Stefan Bühler <stbuehler@web.de> git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2896 152afb58-edef-0310-8abb-c4023f1b3aa9
-rw-r--r--NEWS1
-rw-r--r--src/configfile.c12
2 files changed, 13 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index f6267025..faac87e7 100644
--- a/NEWS
+++ b/NEWS
@@ -29,6 +29,7 @@ NEWS
* [auth] put REMOTE_USER into cgi environment, making it accessible to lua via lighty.req_env (fixes #2495)
* [auth] new method "extern" to use already present REMOTE_USER (from magnet, ssl, ...) (fixes #2436)
* [core] remove requirement that default doc-root has to exist, there are reasonable scenarios not requiring static files at all
+ * [core] check whether server.chroot exists
- 1.4.32 - 2012-11-21
* Code cleanup with clang/sparse (fixes #2437, thx kibi)
diff --git a/src/configfile.c b/src/configfile.c
index 9226ade8..7408ed0a 100644
--- a/src/configfile.c
+++ b/src/configfile.c
@@ -1241,6 +1241,18 @@ int config_set_defaults(server *srv) {
{ FDEVENT_HANDLER_UNSET, NULL }
};
+ if (!buffer_is_empty(srv->srvconf.changeroot)) {
+ if (-1 == stat(srv->srvconf.changeroot->ptr, &st1)) {
+ log_error_write(srv, __FILE__, __LINE__, "sb",
+ "server.chroot doesn't exist:", srv->srvconf.changeroot);
+ return -1;
+ }
+ if (!S_ISDIR(st1.st_mode)) {
+ log_error_write(srv, __FILE__, __LINE__, "sb",
+ "server.chroot isn't a directory:", srv->srvconf.changeroot);
+ return -1;
+ }
+ }
if (buffer_is_empty(s->document_root)) {
log_error_write(srv, __FILE__, __LINE__, "s",