Changeset 4493:47ece8818978 in nginx


Ignore:
Timestamp:
02/27/12 16:46:57 (8 years ago)
Author:
Valentin Bartenev <vbart@…>
Branch:
default
Phase:
public
Convert:
svn:c3fe7df1-7212-e011-8a91-001109144009/trunk@4494
Message:

Disable symlinks: added the "from" parameter support to the open file cache.

Location:
src/core
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/core/ngx_open_file_cache.c

    r4488 r4493  
    230230#if (NGX_HAVE_OPENAT)
    231231                && of->disable_symlinks == file->disable_symlinks
     232                && of->disable_symlinks_from == file->disable_symlinks_from
    232233#endif
    233234            ))
     
    396397#if (NGX_HAVE_OPENAT)
    397398    file->disable_symlinks = of->disable_symlinks;
     399    file->disable_symlinks_from = of->disable_symlinks_from;
    398400#endif
    399401
     
    584586    at_name = *name;
    585587
    586     if (*p == '/') {
     588    if (of->disable_symlinks_from) {
     589
     590        cp = p + of->disable_symlinks_from;
     591
     592        *cp = '\0';
     593
     594        at_fd = ngx_open_file(p, NGX_FILE_SEARCH|NGX_FILE_NONBLOCK,
     595                              NGX_FILE_OPEN, 0);
     596
     597        *cp = '/';
     598
     599        if (at_fd == NGX_INVALID_FILE) {
     600            of->err = ngx_errno;
     601            of->failed = ngx_open_file_n;
     602            return NGX_INVALID_FILE;
     603        }
     604
     605        at_name.len = of->disable_symlinks_from;
     606        p = cp + 1;
     607
     608    } else if (*p == '/') {
     609
    587610        at_fd = ngx_open_file("/",
    588611                              NGX_FILE_SEARCH|NGX_FILE_NONBLOCK,
  • src/core/ngx_open_file_cache.h

    r4477 r4493  
    3434
    3535#if (NGX_HAVE_OPENAT)
     36    size_t                   disable_symlinks_from;
    3637    unsigned                 disable_symlinks:2;
    3738#endif
     
    7071
    7172#if (NGX_HAVE_OPENAT)
     73    size_t                   disable_symlinks_from;
    7274    unsigned                 disable_symlinks:2;
    7375#endif
Note: See TracChangeset for help on using the changeset viewer.