Lines Matching refs:p
40 plugin_data *p; in INIT_FUNC() local
42 p = calloc(1, sizeof(*p)); in INIT_FUNC()
44 p->username = buffer_init(); in INIT_FUNC()
45 p->temp_path = buffer_init(); in INIT_FUNC()
47 return p; in INIT_FUNC()
52 plugin_data *p = p_d; in FREE_FUNC() local
54 if (!p) return HANDLER_GO_ON; in FREE_FUNC()
56 if (p->config_storage) { in FREE_FUNC()
60 plugin_config *s = p->config_storage[i]; in FREE_FUNC()
69 free(p->config_storage); in FREE_FUNC()
72 buffer_free(p->username); in FREE_FUNC()
73 buffer_free(p->temp_path); in FREE_FUNC()
75 free(p); in FREE_FUNC()
83 plugin_data *p = p_d; in SETDEFAULTS_FUNC() local
95 if (!p) return HANDLER_ERROR; in SETDEFAULTS_FUNC()
97 p->config_storage = calloc(1, srv->config_context->used * sizeof(specific_config *)); in SETDEFAULTS_FUNC()
115 p->config_storage[i] = s; in SETDEFAULTS_FUNC()
126 p->conf.x = s->x;
127 static int mod_userdir_patch_connection(server *srv, connection *con, plugin_data *p) { in mod_userdir_patch_connection() argument
129 plugin_config *s = p->config_storage[0]; in mod_userdir_patch_connection()
140 s = p->config_storage[i]; in mod_userdir_patch_connection()
168 plugin_data *p = p_d; in URIHANDLER_FUNC() local
177 mod_userdir_patch_connection(srv, con, p); in URIHANDLER_FUNC()
182 if (p->conf.path->used == 0) return HANDLER_GO_ON; in URIHANDLER_FUNC()
201 buffer_copy_string_len(p->username, con->uri.path->ptr + 2, rel_url - (con->uri.path->ptr + 2)); in URIHANDLER_FUNC()
203 if (buffer_is_empty(p->conf.basepath) in URIHANDLER_FUNC()
205 && NULL == (pwd = getpwnam(p->username->ptr)) in URIHANDLER_FUNC()
213 for (k = 0; k < p->conf.exclude_user->used; k++) { in URIHANDLER_FUNC()
214 data_string *ds = (data_string *)p->conf.exclude_user->data[k]; in URIHANDLER_FUNC()
216 if (buffer_is_equal(ds->value, p->username)) { in URIHANDLER_FUNC()
222 if (p->conf.include_user->used) { in URIHANDLER_FUNC()
224 for (k = 0; k < p->conf.include_user->used; k++) { in URIHANDLER_FUNC()
225 data_string *ds = (data_string *)p->conf.include_user->data[k]; in URIHANDLER_FUNC()
227 if (buffer_is_equal(ds->value, p->username)) { in URIHANDLER_FUNC()
239 if (buffer_is_empty(p->conf.basepath)) { in URIHANDLER_FUNC()
241 buffer_copy_string(p->temp_path, pwd->pw_dir); in URIHANDLER_FUNC()
249 for (cp = p->username->ptr; *cp; cp++) { in URIHANDLER_FUNC()
263 buffer_to_lower(p->username); in URIHANDLER_FUNC()
266 buffer_copy_string_buffer(p->temp_path, p->conf.basepath); in URIHANDLER_FUNC()
267 BUFFER_APPEND_SLASH(p->temp_path); in URIHANDLER_FUNC()
268 if (p->conf.letterhomes) { in URIHANDLER_FUNC()
269 buffer_append_string_len(p->temp_path, p->username->ptr, 1); in URIHANDLER_FUNC()
270 BUFFER_APPEND_SLASH(p->temp_path); in URIHANDLER_FUNC()
272 buffer_append_string_buffer(p->temp_path, p->username); in URIHANDLER_FUNC()
274 BUFFER_APPEND_SLASH(p->temp_path); in URIHANDLER_FUNC()
275 buffer_append_string_buffer(p->temp_path, p->conf.path); in URIHANDLER_FUNC()
277 if (buffer_is_empty(p->conf.basepath)) { in URIHANDLER_FUNC()
281 ret = stat(p->temp_path->ptr, &st); in URIHANDLER_FUNC()
294 BUFFER_APPEND_SLASH(p->temp_path); in URIHANDLER_FUNC()
303 buffer_append_string(p->temp_path, rel_url + 1); /* skip the / */ in URIHANDLER_FUNC()
305 buffer_copy_string_buffer(con->physical.path, p->temp_path); in URIHANDLER_FUNC()
307 buffer_reset(p->temp_path); in URIHANDLER_FUNC()
314 int mod_userdir_plugin_init(plugin *p);
315 int mod_userdir_plugin_init(plugin *p) { in mod_userdir_plugin_init() argument
316 p->version = LIGHTTPD_VERSION_ID; in mod_userdir_plugin_init()
317 p->name = buffer_init_string("userdir"); in mod_userdir_plugin_init()
319 p->init = mod_userdir_init; in mod_userdir_plugin_init()
320 p->handle_physical = mod_userdir_docroot_handler; in mod_userdir_plugin_init()
321 p->set_defaults = mod_userdir_set_defaults; in mod_userdir_plugin_init()
322 p->cleanup = mod_userdir_free; in mod_userdir_plugin_init()
324 p->data = NULL; in mod_userdir_plugin_init()