Mercurial > hg > nginx
comparison src/core/ngx_file.c @ 1381:d59617e7e6a1 stable-0.5
r1292, r1296 merge:
proxy_store and fastcgi_store, proxy_store_access and fastcgi_store_access
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Sat, 11 Aug 2007 10:11:33 +0000 |
parents | ccd8734e4a80 |
children |
comparison
equal
deleted
inserted
replaced
1360:e06ffbeccf71 | 1381:d59617e7e6a1 |
---|---|
288 if (ngx_add_path(cf, slot) == NGX_ERROR) { | 288 if (ngx_add_path(cf, slot) == NGX_ERROR) { |
289 return NGX_CONF_ERROR; | 289 return NGX_CONF_ERROR; |
290 } | 290 } |
291 | 291 |
292 return NGX_CONF_OK; | 292 return NGX_CONF_OK; |
293 } | |
294 | |
295 | |
296 char * | |
297 ngx_conf_set_access_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | |
298 { | |
299 char *confp = conf; | |
300 | |
301 u_char *p; | |
302 ngx_str_t *value; | |
303 ngx_uint_t i, right, shift, *access; | |
304 | |
305 access = (ngx_uint_t *) (confp + cmd->offset); | |
306 | |
307 if (*access != NGX_CONF_UNSET_UINT) { | |
308 return "is duplicate"; | |
309 } | |
310 | |
311 value = cf->args->elts; | |
312 | |
313 *access = 0600; | |
314 | |
315 for (i = 1; i < cf->args->nelts; i++) { | |
316 | |
317 p = value[i].data; | |
318 | |
319 if (ngx_strncmp(p, "user:", sizeof("user:") - 1) == 0) { | |
320 shift = 6; | |
321 p += sizeof("user:") - 1; | |
322 | |
323 } else if (ngx_strncmp(p, "group:", sizeof("group:") - 1) == 0) { | |
324 shift = 3; | |
325 p += sizeof("group:") - 1; | |
326 | |
327 } else if (ngx_strncmp(p, "all:", sizeof("all:") - 1) == 0) { | |
328 shift = 0; | |
329 p += sizeof("all:") - 1; | |
330 | |
331 } else { | |
332 goto invalid; | |
333 } | |
334 | |
335 if (ngx_strcmp(p, "rw") == 0) { | |
336 right = 6; | |
337 | |
338 } else if (ngx_strcmp(p, "r") == 0) { | |
339 right = 4; | |
340 | |
341 } else { | |
342 goto invalid; | |
343 } | |
344 | |
345 *access |= right << shift; | |
346 } | |
347 | |
348 return NGX_CONF_OK; | |
349 | |
350 invalid: | |
351 | |
352 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "invalid value \"%V\"", &value[i]); | |
353 | |
354 return NGX_CONF_ERROR; | |
293 } | 355 } |
294 | 356 |
295 | 357 |
296 ngx_int_t | 358 ngx_int_t |
297 ngx_add_path(ngx_conf_t *cf, ngx_path_t **slot) | 359 ngx_add_path(ngx_conf_t *cf, ngx_path_t **slot) |