comparison src/http/modules/ngx_http_log_module.c @ 4478:08713bac87fc

Support for disable_symlinks in various modules.
author Andrey Belov <defan@nginx.com>
date Mon, 13 Feb 2012 16:32:21 +0000
parents 41f640a693de
children 13e09cf11d4e
comparison
equal deleted inserted replaced
4477:7033faf6dc3c 4478:08713bac87fc
371 ngx_str_t log, path; 371 ngx_str_t log, path;
372 ngx_open_file_info_t of; 372 ngx_open_file_info_t of;
373 ngx_http_log_loc_conf_t *llcf; 373 ngx_http_log_loc_conf_t *llcf;
374 ngx_http_core_loc_conf_t *clcf; 374 ngx_http_core_loc_conf_t *clcf;
375 375
376 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
377
376 if (!r->root_tested) { 378 if (!r->root_tested) {
377 379
378 /* test root directory existance */ 380 /* test root directory existance */
379 381
380 if (ngx_http_map_uri_to_path(r, &path, &root, 0) == NULL) { 382 if (ngx_http_map_uri_to_path(r, &path, &root, 0) == NULL) {
381 /* simulate successfull logging */ 383 /* simulate successfull logging */
382 return len; 384 return len;
383 } 385 }
384 386
385 path.data[root] = '\0'; 387 path.data[root] = '\0';
386
387 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
388 388
389 ngx_memzero(&of, sizeof(ngx_open_file_info_t)); 389 ngx_memzero(&of, sizeof(ngx_open_file_info_t));
390 390
391 of.valid = clcf->open_file_cache_valid; 391 of.valid = clcf->open_file_cache_valid;
392 of.min_uses = clcf->open_file_cache_min_uses; 392 of.min_uses = clcf->open_file_cache_min_uses;
393 of.test_dir = 1; 393 of.test_dir = 1;
394 of.test_only = 1; 394 of.test_only = 1;
395 of.errors = clcf->open_file_cache_errors; 395 of.errors = clcf->open_file_cache_errors;
396 of.events = clcf->open_file_cache_events; 396 of.events = clcf->open_file_cache_events;
397 #if (NGX_HAVE_OPENAT)
398 of.disable_symlinks = clcf->disable_symlinks;
399 #endif
397 400
398 if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool) 401 if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool)
399 != NGX_OK) 402 != NGX_OK)
400 { 403 {
401 if (of.err == 0) { 404 if (of.err == 0) {
439 442
440 of.log = 1; 443 of.log = 1;
441 of.valid = llcf->open_file_cache_valid; 444 of.valid = llcf->open_file_cache_valid;
442 of.min_uses = llcf->open_file_cache_min_uses; 445 of.min_uses = llcf->open_file_cache_min_uses;
443 of.directio = NGX_OPEN_FILE_DIRECTIO_OFF; 446 of.directio = NGX_OPEN_FILE_DIRECTIO_OFF;
447 #if (NGX_HAVE_OPENAT)
448 of.disable_symlinks = clcf->disable_symlinks;
449 #endif
444 450
445 if (ngx_open_cached_file(llcf->open_file_cache, &log, &of, r->pool) 451 if (ngx_open_cached_file(llcf->open_file_cache, &log, &of, r->pool)
446 != NGX_OK) 452 != NGX_OK)
447 { 453 {
448 ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno, 454 ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno,