]> git.kaiwu.me - nginx.git/commit
Added disable_symlinks directive.
authorAndrey Belov <defan@nginx.com>
Mon, 13 Feb 2012 16:29:04 +0000 (16:29 +0000)
committerAndrey Belov <defan@nginx.com>
Mon, 13 Feb 2012 16:29:04 +0000 (16:29 +0000)
commitbd1e719bf9c4bc58076e7b52e87be645c9b803f5
treef1c94ff9e91e2d2594ba9d1ae7f92120cca36722
parent32c8df44d5f53026d92ec24bcf4c864359395e55
Added disable_symlinks directive.

To completely disable symlinks (disable_symlinks on)
we use openat(O_NOFOLLOW) for each path component
to avoid races.

To allow symlinks with the same owner (disable_symlinks if_not_owner),
use openat() (followed by fstat()) and fstatat(AT_SYMLINK_NOFOLLOW),
and then compare uids between fstat() and fstatat().

As there is a race between openat() and fstatat() we don't
know if openat() in fact opened symlink or not.  Therefore,
we have to compare uids even if fstatat() reports the opened
component isn't a symlink (as we don't know whether it was
symlink during openat() or not).

Default value is off, i.e. symlinks are allowed.
src/core/ngx_core.h
src/core/ngx_open_file_cache.c
src/core/ngx_open_file_cache.h
src/http/ngx_http_core_module.c
src/http/ngx_http_core_module.h