Browse Source

- support letterhomes in mod_userdir (#1473)

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2058 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.19
Elan Ruusamäe 14 years ago
parent
commit
022742a5ae
  1. 1
      NEWS
  2. 11
      src/mod_userdir.c

1
NEWS

@ -19,6 +19,7 @@ NEWS
* open log immediately after daemonizing, fixes SIGPIPEs on startup (#165)
* HTTPS env var should be "on" when using mod_extforward and the X-Forwarded-Proto header is set. (#1499)
* generate ETag and Last-Modified headers for mod_ssi based on newest modified include (#1491)
* support letterhomes in mod_userdir (#1473)
- 1.4.18 - 2007-09-09

11
src/mod_userdir.c

@ -21,6 +21,7 @@ typedef struct {
array *include_user;
buffer *path;
buffer *basepath;
unsigned short letterhomes;
} plugin_config;
typedef struct {
@ -87,6 +88,7 @@ SETDEFAULTS_FUNC(mod_userdir_set_defaults) {
{ "userdir.exclude-user", NULL, T_CONFIG_ARRAY, T_CONFIG_SCOPE_CONNECTION }, /* 1 */
{ "userdir.include-user", NULL, T_CONFIG_ARRAY, T_CONFIG_SCOPE_CONNECTION }, /* 2 */
{ "userdir.basepath", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 3 */
{ "userdir.letterhomes", NULL, T_CONFIG_BOOLEAN,T_CONFIG_SCOPE_CONNECTION }, /* 4 */
{ NULL, NULL, T_CONFIG_UNSET, T_CONFIG_SCOPE_UNSET }
};
@ -102,11 +104,13 @@ SETDEFAULTS_FUNC(mod_userdir_set_defaults) {
s->include_user = array_init();
s->path = buffer_init();
s->basepath = buffer_init();
s->letterhomes = 0;
cv[0].destination = s->path;
cv[1].destination = s->exclude_user;
cv[2].destination = s->include_user;
cv[3].destination = s->basepath;
cv[4].destination = &(s->letterhomes);
p->config_storage[i] = s;
@ -128,6 +132,7 @@ static int mod_userdir_patch_connection(server *srv, connection *con, plugin_dat
PATCH(exclude_user);
PATCH(include_user);
PATCH(basepath);
PATCH(letterhomes);
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
@ -149,6 +154,8 @@ static int mod_userdir_patch_connection(server *srv, connection *con, plugin_dat
PATCH(include_user);
} else if (buffer_is_equal_string(du->key, CONST_STR_LEN("userdir.basepath"))) {
PATCH(basepath);
} else if (buffer_is_equal_string(du->key, CONST_STR_LEN("userdir.letterhomes"))) {
PATCH(letterhomes);
}
}
}
@ -253,6 +260,10 @@ URIHANDLER_FUNC(mod_userdir_docroot_handler) {
buffer_copy_string_buffer(p->temp_path, p->conf.basepath);
BUFFER_APPEND_SLASH(p->temp_path);
if (p->conf.letterhomes) {
buffer_append_string_len(p->temp_path, p->username->ptr, 1);
BUFFER_APPEND_SLASH(p->temp_path);
}
buffer_append_string_buffer(p->temp_path, p->username);
}
BUFFER_APPEND_SLASH(p->temp_path);

Loading…
Cancel
Save