diff options
author | stbuehler <stbuehler@152afb58-edef-0310-8abb-c4023f1b3aa9> | 2008-09-21 20:03:59 +0000 |
---|---|---|
committer | stbuehler <stbuehler@152afb58-edef-0310-8abb-c4023f1b3aa9> | 2008-09-21 20:03:59 +0000 |
commit | 85081fd72df131be00331fa21358e5a31dd13964 (patch) | |
tree | 9208f69e3452caaef3723bd54d0b15f48dfe998a /src/mod_userdir.c | |
parent | a6aded5d80b07648d1d1a0fba4a62e6171676c68 (diff) | |
download | lighttpd-85081fd72df131be00331fa21358e5a31dd13964.tar.gz |
Fix bug with case-insensitive filenames in mod_userdir (#1589)
git-svn-id: svn://svn.lighttpd.net/lighttpd/trunk@2308 152afb58-edef-0310-8abb-c4023f1b3aa9
Diffstat (limited to 'src/mod_userdir.c')
-rw-r--r-- | src/mod_userdir.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/mod_userdir.c b/src/mod_userdir.c index c1e35145..37ae3a86 100644 --- a/src/mod_userdir.c +++ b/src/mod_userdir.c @@ -257,6 +257,9 @@ URIHANDLER_FUNC(mod_userdir_docroot_handler) { return HANDLER_GO_ON; } } + if (con->conf.force_lowercase_filenames) { + buffer_to_lower(p->username); + } buffer_copy_string_buffer(p->temp_path, p->conf.basepath); PATHNAME_APPEND_SLASH(p->temp_path); @@ -279,8 +282,24 @@ URIHANDLER_FUNC(mod_userdir_docroot_handler) { } } + /* 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 + * we assume that no docroot/physical handler changed this + * (docroot should only set the docroot/server name, phyiscal should only change the phyiscal.path; + * the exception mod_secure_download doesn't work with userdir anyway) + */ PATHNAME_APPEND_SLASH(p->temp_path); - buffer_append_string(p->temp_path, rel_url + 1); /* skip the / */ + /* if no second '/' is found, we assume that it was stripped from the uri.path for the special handling + * on windows. + * we do not care about the trailing slash here on windows, as we already ensured it is a directory + * + * TODO: what to do with trailing dots in usernames on windows? they may result in the same directory + * as a username without them. + */ + if (NULL != (rel_url = strchr(con->physical.rel_path->ptr + 2, '/'))) { + buffer_append_string(p->temp_path, rel_url + 1); /* skip the / */ + } buffer_copy_string_buffer(con->physical.path, p->temp_path); buffer_reset(p->temp_path); |