From 17762fad013e3f561353fa8dfbd605301c1d6a50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20B=C3=BChler?= Date: Fri, 10 Jan 2014 12:04:57 +0000 Subject: [PATCH] maintain physical.basedir (the "acting" doc-root as prefix of physical.path) in more places MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Stefan Bühler git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2926 152afb58-edef-0310-8abb-c4023f1b3aa9 --- NEWS | 1 + src/mod_magnet.c | 3 +++ src/mod_secure_download.c | 1 + src/mod_userdir.c | 2 ++ src/response.c | 3 ++- 5 files changed, 9 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 747bcc15..97096fa1 100644 --- a/NEWS +++ b/NEWS @@ -12,6 +12,7 @@ NEWS * [stat-cache] fix FAM cleanup/fdevent handling * [core] check success of setuid,setgid,setgroups (CVE-2013-4559) * [ssl] fix regression from CVE-2013-4508 (client-cert sessions were broken) + * maintain physical.basedir (the "acting" doc-root as prefix of physical.path) in more places - 1.4.33 - 2013-09-27 * mod_fastcgi: fix mix up of "mode" => "authorizer" in other fastcgi configs (fixes #2465, thx peex) diff --git a/src/mod_magnet.c b/src/mod_magnet.c index 0bce4d18..d3069f6a 100644 --- a/src/mod_magnet.c +++ b/src/mod_magnet.c @@ -446,6 +446,7 @@ typedef struct { MAGNET_ENV_PHYICAL_PATH, MAGNET_ENV_PHYICAL_REL_PATH, MAGNET_ENV_PHYICAL_DOC_ROOT, + MAGNET_ENV_PHYICAL_BASEDIR, MAGNET_ENV_URI_PATH, MAGNET_ENV_URI_PATH_RAW, @@ -466,6 +467,7 @@ static const magnet_env_t magnet_env[] = { { "physical.path", MAGNET_ENV_PHYICAL_PATH }, { "physical.rel-path", MAGNET_ENV_PHYICAL_REL_PATH }, { "physical.doc-root", MAGNET_ENV_PHYICAL_DOC_ROOT }, + { "physical.basedir", MAGNET_ENV_PHYICAL_BASEDIR }, { "uri.path", MAGNET_ENV_URI_PATH }, { "uri.path-raw", MAGNET_ENV_URI_PATH_RAW }, @@ -497,6 +499,7 @@ static buffer *magnet_env_get_buffer_by_id(server *srv, connection *con, int id) case MAGNET_ENV_PHYICAL_PATH: dest = con->physical.path; break; case MAGNET_ENV_PHYICAL_REL_PATH: dest = con->physical.rel_path; break; case MAGNET_ENV_PHYICAL_DOC_ROOT: dest = con->physical.doc_root; break; + case MAGNET_ENV_PHYICAL_BASEDIR: dest = con->physical.basedir; break; case MAGNET_ENV_URI_PATH: dest = con->uri.path; break; case MAGNET_ENV_URI_PATH_RAW: dest = con->uri.path_raw; break; diff --git a/src/mod_secure_download.c b/src/mod_secure_download.c index ca1f625d..b76c876c 100644 --- a/src/mod_secure_download.c +++ b/src/mod_secure_download.c @@ -276,6 +276,7 @@ URIHANDLER_FUNC(mod_secdownload_uri_handler) { */ buffer_copy_string_buffer(con->physical.doc_root, p->conf.doc_root); + buffer_copy_string_buffer(con->physical.basedir, p->conf.doc_root); buffer_copy_string(con->physical.rel_path, rel_uri); buffer_copy_string_buffer(con->physical.path, con->physical.doc_root); buffer_append_string_buffer(con->physical.path, con->physical.rel_path); diff --git a/src/mod_userdir.c b/src/mod_userdir.c index 9063bed4..572b5e7f 100644 --- a/src/mod_userdir.c +++ b/src/mod_userdir.c @@ -293,6 +293,8 @@ URIHANDLER_FUNC(mod_userdir_docroot_handler) { } } + buffer_copy_string_buffer(con->physical.basedir, p->temp_path); + /* the physical rel_path is basically the same as uri.path; * but it is converted to lowercase in case of force_lowercase_filenames and some special handling * for trailing '.', ' ' and '/' on windows diff --git a/src/response.c b/src/response.c index ffa4aae4..521ab85c 100644 --- a/src/response.c +++ b/src/response.c @@ -516,8 +516,8 @@ handler_t http_response_prepare(server *srv, connection *con) { * */ + buffer_copy_string_buffer(con->physical.basedir, con->physical.doc_root); buffer_copy_string_buffer(con->physical.path, con->physical.doc_root); - buffer_copy_string_buffer(con->physical.basedir, con->physical.path); BUFFER_APPEND_SLASH(con->physical.path); if (con->physical.rel_path->used && con->physical.rel_path->ptr[0] == '/') { @@ -549,6 +549,7 @@ handler_t http_response_prepare(server *srv, connection *con) { if (con->conf.log_request_handling) { log_error_write(srv, __FILE__, __LINE__, "s", "-- logical -> physical"); log_error_write(srv, __FILE__, __LINE__, "sb", "Doc-Root :", con->physical.doc_root); + log_error_write(srv, __FILE__, __LINE__, "sb", "Basedir :", con->physical.basedir); log_error_write(srv, __FILE__, __LINE__, "sb", "Rel-Path :", con->physical.rel_path); log_error_write(srv, __FILE__, __LINE__, "sb", "Path :", con->physical.path); }