comparison src/http/ngx_http_core_module.c @ 4494:13e09cf11d4e

Disable symlinks: initialization of the "disable_symlinks" field in ngx_open_file_info_t moved to a separate function. This is preparation for the "from=" parameter implementation of the "disable_symlinks" directive.
author Valentin Bartenev <vbart@nginx.com>
date Mon, 27 Feb 2012 16:51:28 +0000
parents d11f86a16e3b
children b4379a91f9b5
comparison
equal deleted inserted replaced
4493:47ece8818978 4494:13e09cf11d4e
1318 of.valid = clcf->open_file_cache_valid; 1318 of.valid = clcf->open_file_cache_valid;
1319 of.min_uses = clcf->open_file_cache_min_uses; 1319 of.min_uses = clcf->open_file_cache_min_uses;
1320 of.test_only = 1; 1320 of.test_only = 1;
1321 of.errors = clcf->open_file_cache_errors; 1321 of.errors = clcf->open_file_cache_errors;
1322 of.events = clcf->open_file_cache_events; 1322 of.events = clcf->open_file_cache_events;
1323 #if (NGX_HAVE_OPENAT) 1323
1324 of.disable_symlinks = clcf->disable_symlinks; 1324 if (ngx_http_set_disable_symlinks(r, clcf, &path, &of) != NGX_OK) {
1325 #endif 1325 ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
1326 return NGX_OK;
1327 }
1326 1328
1327 if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool) 1329 if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool)
1328 != NGX_OK) 1330 != NGX_OK)
1329 { 1331 {
1330 if (of.err != NGX_ENOENT 1332 if (of.err != NGX_ENOENT
2640 2642
2641 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, 2643 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
2642 "http cleanup add: %p", cln); 2644 "http cleanup add: %p", cln);
2643 2645
2644 return cln; 2646 return cln;
2647 }
2648
2649
2650 ngx_int_t
2651 ngx_http_set_disable_symlinks(ngx_http_request_t *r,
2652 ngx_http_core_loc_conf_t *clcf, ngx_str_t *path, ngx_open_file_info_t *of)
2653 {
2654 #if (NGX_HAVE_OPENAT)
2655 of->disable_symlinks = clcf->disable_symlinks;
2656 #endif
2657
2658 return NGX_OK;
2645 } 2659 }
2646 2660
2647 2661
2648 static char * 2662 static char *
2649 ngx_http_core_server(ngx_conf_t *cf, ngx_command_t *cmd, void *dummy) 2663 ngx_http_core_server(ngx_conf_t *cf, ngx_command_t *cmd, void *dummy)