Klaus Demo nginx / 8ce8f66
Support for disable_symlinks in various modules. Andrey Belov 10 years ago
8 changed file(s) with 64 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
108108 of.min_uses = clcf->open_file_cache_min_uses;
109109 of.errors = clcf->open_file_cache_errors;
110110 of.events = clcf->open_file_cache_events;
111 #if (NGX_HAVE_OPENAT)
112 of.disable_symlinks = clcf->disable_symlinks;
113 #endif
111114
112115 if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool)
113116 != NGX_OK)
126129 break;
127130
128131 case NGX_EACCES:
132 #if (NGX_HAVE_OPENAT)
133 case NGX_EMLINK:
134 case NGX_ELOOP:
135 #endif
129136
130137 level = NGX_LOG_ERR;
131138 rc = NGX_HTTP_FORBIDDEN;
128128 of.min_uses = clcf->open_file_cache_min_uses;
129129 of.errors = clcf->open_file_cache_errors;
130130 of.events = clcf->open_file_cache_events;
131 #if (NGX_HAVE_OPENAT)
132 of.disable_symlinks = clcf->disable_symlinks;
133 #endif
131134
132135 if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool)
133136 != NGX_OK)
144147 return NGX_DECLINED;
145148
146149 case NGX_EACCES:
150 #if (NGX_HAVE_OPENAT)
151 case NGX_EMLINK:
152 case NGX_ELOOP:
153 #endif
147154
148155 level = NGX_LOG_ERR;
149156 break;
208208 of.test_only = 1;
209209 of.errors = clcf->open_file_cache_errors;
210210 of.events = clcf->open_file_cache_events;
211 #if (NGX_HAVE_OPENAT)
212 of.disable_symlinks = clcf->disable_symlinks;
213 #endif
211214
212215 if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool)
213216 != NGX_OK)
219222 return NGX_HTTP_INTERNAL_SERVER_ERROR;
220223 }
221224
225 #if (NGX_HAVE_OPENAT)
226 if (of.err == NGX_EMLINK
227 || of.err == NGX_ELOOP)
228 {
229 return NGX_HTTP_FORBIDDEN;
230 }
231 #endif
232
222233 if (of.err == NGX_ENOTDIR
223234 || of.err == NGX_ENAMETOOLONG
224235 || of.err == NGX_EACCES)
295306 of.test_only = 1;
296307 of.valid = clcf->open_file_cache_valid;
297308 of.errors = clcf->open_file_cache_errors;
309 #if (NGX_HAVE_OPENAT)
310 of.disable_symlinks = clcf->disable_symlinks;
311 #endif
298312
299313 if (ngx_open_cached_file(clcf->open_file_cache, &dir, &of, r->pool)
300314 != NGX_OK)
301315 {
302316 if (of.err) {
317
318 #if (NGX_HAVE_OPENAT)
319 if (of.err == NGX_EMLINK
320 || of.err == NGX_ELOOP)
321 {
322 return NGX_HTTP_FORBIDDEN;
323 }
324 #endif
303325
304326 if (of.err == NGX_ENOENT) {
305327 *last = c;
372372 ngx_http_log_loc_conf_t *llcf;
373373 ngx_http_core_loc_conf_t *clcf;
374374
375 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
376
375377 if (!r->root_tested) {
376378
377379 /* test root directory existance */
382384 }
383385
384386 path.data[root] = '\0';
385
386 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
387387
388388 ngx_memzero(&of, sizeof(ngx_open_file_info_t));
389389
393393 of.test_only = 1;
394394 of.errors = clcf->open_file_cache_errors;
395395 of.events = clcf->open_file_cache_events;
396 #if (NGX_HAVE_OPENAT)
397 of.disable_symlinks = clcf->disable_symlinks;
398 #endif
396399
397400 if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool)
398401 != NGX_OK)
440443 of.valid = llcf->open_file_cache_valid;
441444 of.min_uses = llcf->open_file_cache_min_uses;
442445 of.directio = NGX_OPEN_FILE_DIRECTIO_OFF;
446 #if (NGX_HAVE_OPENAT)
447 of.disable_symlinks = clcf->disable_symlinks;
448 #endif
443449
444450 if (ngx_open_cached_file(llcf->open_file_cache, &log, &of, r->pool)
445451 != NGX_OK)
439439 of.min_uses = clcf->open_file_cache_min_uses;
440440 of.errors = clcf->open_file_cache_errors;
441441 of.events = clcf->open_file_cache_events;
442 #if (NGX_HAVE_OPENAT)
443 of.disable_symlinks = clcf->disable_symlinks;
444 #endif
442445
443446 if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool)
444447 != NGX_OK)
457460 break;
458461
459462 case NGX_EACCES:
463 #if (NGX_HAVE_OPENAT)
464 case NGX_EMLINK:
465 case NGX_ELOOP:
466 #endif
460467
461468 level = NGX_LOG_ERR;
462469 rc = NGX_HTTP_FORBIDDEN;
9393 of.min_uses = clcf->open_file_cache_min_uses;
9494 of.errors = clcf->open_file_cache_errors;
9595 of.events = clcf->open_file_cache_events;
96 #if (NGX_HAVE_OPENAT)
97 of.disable_symlinks = clcf->disable_symlinks;
98 #endif
9699
97100 if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool)
98101 != NGX_OK)
111114 break;
112115
113116 case NGX_EACCES:
117 #if (NGX_HAVE_OPENAT)
118 case NGX_EMLINK:
119 case NGX_ELOOP:
120 #endif
114121
115122 level = NGX_LOG_ERR;
116123 rc = NGX_HTTP_FORBIDDEN;
661661 of.min_uses = clcf->open_file_cache_min_uses;
662662 of.errors = clcf->open_file_cache_errors;
663663 of.events = clcf->open_file_cache_events;
664 #if (NGX_HAVE_OPENAT)
665 of.disable_symlinks = clcf->disable_symlinks;
666 #endif
664667
665668 if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool)
666669 != NGX_OK)
15041504 of.test_only = 1;
15051505 of.errors = clcf->open_file_cache_errors;
15061506 of.events = clcf->open_file_cache_events;
1507 #if (NGX_HAVE_OPENAT)
1508 of.disable_symlinks = clcf->disable_symlinks;
1509 #endif
15071510
15081511 if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool)
15091512 != NGX_OK)