Klaus Demo nginx / 3467911
Disable symlinks: added the "from" parameter support to the open file cache. Valentin Bartenev 10 years ago
2 changed file(s) with 26 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
228228 && now - file->created < of->valid
229229 #if (NGX_HAVE_OPENAT)
230230 && of->disable_symlinks == file->disable_symlinks
231 && of->disable_symlinks_from == file->disable_symlinks_from
231232 #endif
232233 ))
233234 {
394395 file->err = of->err;
395396 #if (NGX_HAVE_OPENAT)
396397 file->disable_symlinks = of->disable_symlinks;
398 file->disable_symlinks_from = of->disable_symlinks_from;
397399 #endif
398400
399401 if (of->err == 0) {
582584
583585 at_name = *name;
584586
585 if (*p == '/') {
587 if (of->disable_symlinks_from) {
588
589 cp = p + of->disable_symlinks_from;
590
591 *cp = '\0';
592
593 at_fd = ngx_open_file(p, NGX_FILE_SEARCH|NGX_FILE_NONBLOCK,
594 NGX_FILE_OPEN, 0);
595
596 *cp = '/';
597
598 if (at_fd == NGX_INVALID_FILE) {
599 of->err = ngx_errno;
600 of->failed = ngx_open_file_n;
601 return NGX_INVALID_FILE;
602 }
603
604 at_name.len = of->disable_symlinks_from;
605 p = cp + 1;
606
607 } else if (*p == '/') {
608
586609 at_fd = ngx_open_file("/",
587610 NGX_FILE_SEARCH|NGX_FILE_NONBLOCK,
588611 NGX_FILE_OPEN, 0);
3232 ngx_uint_t min_uses;
3333
3434 #if (NGX_HAVE_OPENAT)
35 size_t disable_symlinks_from;
3536 unsigned disable_symlinks:2;
3637 #endif
3738
6869 uint32_t uses;
6970
7071 #if (NGX_HAVE_OPENAT)
72 size_t disable_symlinks_from;
7173 unsigned disable_symlinks:2;
7274 #endif
7375