Project

General

Profile

Feature #1473 ยป mod_userdir.patch

-- kadlec - Anonymous, 2007-11-30 10:35

View differences:

src/mod_userdir.c 2007-11-28 18:47:57.000000000 +0100
21 21
	array *include_user;
22 22
	buffer *path;
23 23
	buffer *basepath;
24
	unsigned short letterhomes;
24 25
} plugin_config;
25 26

  
26 27
typedef struct {
......
87 88
		{ "userdir.exclude-user",       NULL, T_CONFIG_ARRAY,  T_CONFIG_SCOPE_CONNECTION },       /* 1 */
88 89
		{ "userdir.include-user",       NULL, T_CONFIG_ARRAY,  T_CONFIG_SCOPE_CONNECTION },       /* 2 */
89 90
		{ "userdir.basepath",           NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION },       /* 3 */
91
		{ "userdir.letterhomes",	NULL, T_CONFIG_BOOLEAN,T_CONFIG_SCOPE_CONNECTION },	  /* 4 */
90 92
		{ NULL,                         NULL, T_CONFIG_UNSET,  T_CONFIG_SCOPE_UNSET }
91 93
	};
92 94

  
......
102 104
		s->include_user = array_init();
103 105
		s->path = buffer_init();
104 106
		s->basepath = buffer_init();
107
		s->letterhomes = 0;
105 108

  
106 109
		cv[0].destination = s->path;
107 110
		cv[1].destination = s->exclude_user;
108 111
		cv[2].destination = s->include_user;
109 112
		cv[3].destination = s->basepath;
113
		cv[4].destination = &(s->letterhomes);
110 114

  
111 115
		p->config_storage[i] = s;
112 116

  
......
128 132
	PATCH(exclude_user);
129 133
	PATCH(include_user);
130 134
	PATCH(basepath);
135
	PATCH(letterhomes);
131 136

  
132 137
	/* skip the first, the global context */
133 138
	for (i = 1; i < srv->config_context->used; i++) {
......
149 154
				PATCH(include_user);
150 155
			} else if (buffer_is_equal_string(du->key, CONST_STR_LEN("userdir.basepath"))) {
151 156
				PATCH(basepath);
157
			} else if (buffer_is_equal_string(du->key, CONST_STR_LEN("userdir.letterhomes"))) {
158
				PATCH(letterhomes);
152 159
			}
153 160
		}
154 161
	}
......
253 260

  
254 261
		buffer_copy_string_buffer(p->temp_path, p->conf.basepath);
255 262
		BUFFER_APPEND_SLASH(p->temp_path);
263
		if (p->conf.letterhomes) {
264
			buffer_append_string_len(p->temp_path, p->username->ptr, 1);
265
			BUFFER_APPEND_SLASH(p->temp_path);
266
		}
256 267
		buffer_append_string_buffer(p->temp_path, p->username);
257 268
	}
258 269
	BUFFER_APPEND_SLASH(p->temp_path);
    (1-1/1)