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.
Valentin Bartenev
10 years ago
108 | 108 |
of.min_uses = clcf->open_file_cache_min_uses;
|
109 | 109 |
of.errors = clcf->open_file_cache_errors;
|
110 | 110 |
of.events = clcf->open_file_cache_events;
|
111 | |
#if (NGX_HAVE_OPENAT)
|
112 | |
of.disable_symlinks = clcf->disable_symlinks;
|
113 | |
#endif
|
|
111 |
|
|
112 |
if (ngx_http_set_disable_symlinks(r, clcf, &path, &of) != NGX_OK) {
|
|
113 |
return NGX_HTTP_INTERNAL_SERVER_ERROR;
|
|
114 |
}
|
114 | 115 |
|
115 | 116 |
if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool)
|
116 | 117 |
!= NGX_OK)
|
128 | 128 |
of.min_uses = clcf->open_file_cache_min_uses;
|
129 | 129 |
of.errors = clcf->open_file_cache_errors;
|
130 | 130 |
of.events = clcf->open_file_cache_events;
|
131 | |
#if (NGX_HAVE_OPENAT)
|
132 | |
of.disable_symlinks = clcf->disable_symlinks;
|
133 | |
#endif
|
|
131 |
|
|
132 |
if (ngx_http_set_disable_symlinks(r, clcf, &path, &of) != NGX_OK) {
|
|
133 |
return NGX_HTTP_INTERNAL_SERVER_ERROR;
|
|
134 |
}
|
134 | 135 |
|
135 | 136 |
if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool)
|
136 | 137 |
!= NGX_OK)
|
208 | 208 |
of.test_only = 1;
|
209 | 209 |
of.errors = clcf->open_file_cache_errors;
|
210 | 210 |
of.events = clcf->open_file_cache_events;
|
211 | |
#if (NGX_HAVE_OPENAT)
|
212 | |
of.disable_symlinks = clcf->disable_symlinks;
|
213 | |
#endif
|
|
211 |
|
|
212 |
if (ngx_http_set_disable_symlinks(r, clcf, &path, &of) != NGX_OK) {
|
|
213 |
return NGX_HTTP_INTERNAL_SERVER_ERROR;
|
|
214 |
}
|
214 | 215 |
|
215 | 216 |
if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool)
|
216 | 217 |
!= NGX_OK)
|
|
306 | 307 |
of.test_only = 1;
|
307 | 308 |
of.valid = clcf->open_file_cache_valid;
|
308 | 309 |
of.errors = clcf->open_file_cache_errors;
|
309 | |
#if (NGX_HAVE_OPENAT)
|
310 | |
of.disable_symlinks = clcf->disable_symlinks;
|
311 | |
#endif
|
|
310 |
|
|
311 |
if (ngx_http_set_disable_symlinks(r, clcf, &dir, &of) != NGX_OK) {
|
|
312 |
return NGX_HTTP_INTERNAL_SERVER_ERROR;
|
|
313 |
}
|
312 | 314 |
|
313 | 315 |
if (ngx_open_cached_file(clcf->open_file_cache, &dir, &of, r->pool)
|
314 | 316 |
!= NGX_OK)
|
393 | 393 |
of.test_only = 1;
|
394 | 394 |
of.errors = clcf->open_file_cache_errors;
|
395 | 395 |
of.events = clcf->open_file_cache_events;
|
396 | |
#if (NGX_HAVE_OPENAT)
|
397 | |
of.disable_symlinks = clcf->disable_symlinks;
|
398 | |
#endif
|
|
396 |
|
|
397 |
if (ngx_http_set_disable_symlinks(r, clcf, &path, &of) != NGX_OK) {
|
|
398 |
/* simulate successful logging */
|
|
399 |
return len;
|
|
400 |
}
|
399 | 401 |
|
400 | 402 |
if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool)
|
401 | 403 |
!= NGX_OK)
|
|
443 | 445 |
of.valid = llcf->open_file_cache_valid;
|
444 | 446 |
of.min_uses = llcf->open_file_cache_min_uses;
|
445 | 447 |
of.directio = NGX_OPEN_FILE_DIRECTIO_OFF;
|
446 | |
#if (NGX_HAVE_OPENAT)
|
447 | |
of.disable_symlinks = clcf->disable_symlinks;
|
448 | |
#endif
|
|
448 |
|
|
449 |
if (ngx_http_set_disable_symlinks(r, clcf, &log, &of) != NGX_OK) {
|
|
450 |
/* simulate successful logging */
|
|
451 |
return len;
|
|
452 |
}
|
449 | 453 |
|
450 | 454 |
if (ngx_open_cached_file(llcf->open_file_cache, &log, &of, r->pool)
|
451 | 455 |
!= NGX_OK)
|
439 | 439 |
of.min_uses = clcf->open_file_cache_min_uses;
|
440 | 440 |
of.errors = clcf->open_file_cache_errors;
|
441 | 441 |
of.events = clcf->open_file_cache_events;
|
442 | |
#if (NGX_HAVE_OPENAT)
|
443 | |
of.disable_symlinks = clcf->disable_symlinks;
|
444 | |
#endif
|
|
442 |
|
|
443 |
if (ngx_http_set_disable_symlinks(r, clcf, &path, &of) != NGX_OK) {
|
|
444 |
return NGX_HTTP_INTERNAL_SERVER_ERROR;
|
|
445 |
}
|
445 | 446 |
|
446 | 447 |
if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool)
|
447 | 448 |
!= NGX_OK)
|
93 | 93 |
of.min_uses = clcf->open_file_cache_min_uses;
|
94 | 94 |
of.errors = clcf->open_file_cache_errors;
|
95 | 95 |
of.events = clcf->open_file_cache_events;
|
96 | |
#if (NGX_HAVE_OPENAT)
|
97 | |
of.disable_symlinks = clcf->disable_symlinks;
|
98 | |
#endif
|
|
96 |
|
|
97 |
if (ngx_http_set_disable_symlinks(r, clcf, &path, &of) != NGX_OK) {
|
|
98 |
return NGX_HTTP_INTERNAL_SERVER_ERROR;
|
|
99 |
}
|
99 | 100 |
|
100 | 101 |
if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool)
|
101 | 102 |
!= NGX_OK)
|
661 | 661 |
of.min_uses = clcf->open_file_cache_min_uses;
|
662 | 662 |
of.errors = clcf->open_file_cache_errors;
|
663 | 663 |
of.events = clcf->open_file_cache_events;
|
664 | |
#if (NGX_HAVE_OPENAT)
|
665 | |
of.disable_symlinks = clcf->disable_symlinks;
|
666 | |
#endif
|
|
664 |
|
|
665 |
if (ngx_http_set_disable_symlinks(r, clcf, &path, &of) != NGX_OK) {
|
|
666 |
XSRETURN_EMPTY;
|
|
667 |
}
|
667 | 668 |
|
668 | 669 |
if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool)
|
669 | 670 |
!= NGX_OK)
|
1319 | 1319 |
of.test_only = 1;
|
1320 | 1320 |
of.errors = clcf->open_file_cache_errors;
|
1321 | 1321 |
of.events = clcf->open_file_cache_events;
|
1322 | |
#if (NGX_HAVE_OPENAT)
|
1323 | |
of.disable_symlinks = clcf->disable_symlinks;
|
1324 | |
#endif
|
|
1322 |
|
|
1323 |
if (ngx_http_set_disable_symlinks(r, clcf, &path, &of) != NGX_OK) {
|
|
1324 |
ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
|
|
1325 |
return NGX_OK;
|
|
1326 |
}
|
1325 | 1327 |
|
1326 | 1328 |
if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool)
|
1327 | 1329 |
!= NGX_OK)
|
|
2641 | 2643 |
"http cleanup add: %p", cln);
|
2642 | 2644 |
|
2643 | 2645 |
return cln;
|
|
2646 |
}
|
|
2647 |
|
|
2648 |
|
|
2649 |
ngx_int_t
|
|
2650 |
ngx_http_set_disable_symlinks(ngx_http_request_t *r,
|
|
2651 |
ngx_http_core_loc_conf_t *clcf, ngx_str_t *path, ngx_open_file_info_t *of)
|
|
2652 |
{
|
|
2653 |
#if (NGX_HAVE_OPENAT)
|
|
2654 |
of->disable_symlinks = clcf->disable_symlinks;
|
|
2655 |
#endif
|
|
2656 |
|
|
2657 |
return NGX_OK;
|
2644 | 2658 |
}
|
2645 | 2659 |
|
2646 | 2660 |
|
506 | 506 |
|
507 | 507 |
ngx_int_t ngx_http_output_filter(ngx_http_request_t *r, ngx_chain_t *chain);
|
508 | 508 |
ngx_int_t ngx_http_write_filter(ngx_http_request_t *r, ngx_chain_t *chain);
|
|
509 |
|
|
510 |
|
|
511 |
ngx_int_t ngx_http_set_disable_symlinks(ngx_http_request_t *r,
|
|
512 |
ngx_http_core_loc_conf_t *clcf, ngx_str_t *path, ngx_open_file_info_t *of);
|
509 | 513 |
|
510 | 514 |
|
511 | 515 |
extern ngx_module_t ngx_http_core_module;
|
1504 | 1504 |
of.test_only = 1;
|
1505 | 1505 |
of.errors = clcf->open_file_cache_errors;
|
1506 | 1506 |
of.events = clcf->open_file_cache_events;
|
1507 | |
#if (NGX_HAVE_OPENAT)
|
1508 | |
of.disable_symlinks = clcf->disable_symlinks;
|
1509 | |
#endif
|
|
1507 |
|
|
1508 |
if (ngx_http_set_disable_symlinks(r, clcf, &path, &of) != NGX_OK) {
|
|
1509 |
e->ip = ngx_http_script_exit;
|
|
1510 |
e->status = NGX_HTTP_INTERNAL_SERVER_ERROR;
|
|
1511 |
return;
|
|
1512 |
}
|
1510 | 1513 |
|
1511 | 1514 |
if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool)
|
1512 | 1515 |
!= NGX_OK)
|