aboutsummaryrefslogtreecommitdiff
path: root/src/os/unix/ngx_files.h
diff options
context:
space:
mode:
authorValentin Bartenev <vbart@nginx.com>2012-02-21 15:10:13 +0000
committerValentin Bartenev <vbart@nginx.com>2012-02-21 15:10:13 +0000
commit86c5513ecb34ab90027935c329e74b41fdc3a49e (patch)
tree75ec48b4fb2723596218cb7621e28dc78063c98f /src/os/unix/ngx_files.h
parent15b3173c5e5108287f5d74126f29854b14c1db94 (diff)
downloadnginx-86c5513ecb34ab90027935c329e74b41fdc3a49e.tar.gz
nginx-86c5513ecb34ab90027935c329e74b41fdc3a49e.zip
Disable symlinks: use O_SEARCH|O_DIRECTORY to open path components.
Diffstat (limited to 'src/os/unix/ngx_files.h')
-rw-r--r--src/os/unix/ngx_files.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/os/unix/ngx_files.h b/src/os/unix/ngx_files.h
index d397c2fbd..1a35cba17 100644
--- a/src/os/unix/ngx_files.h
+++ b/src/os/unix/ngx_files.h
@@ -78,8 +78,25 @@ typedef struct {
#if (NGX_HAVE_OPENAT)
#define NGX_FILE_NOFOLLOW O_NOFOLLOW
+
+#if defined(O_DIRECTORY)
+#define NGX_FILE_DIRECTORY O_DIRECTORY
+#else
+#define NGX_FILE_DIRECTORY 0
+#endif
+
+#if defined(O_SEARCH)
+#define NGX_FILE_SEARCH O_SEARCH|NGX_FILE_DIRECTORY
+
+#elif defined(O_EXEC)
+#define NGX_FILE_SEARCH O_EXEC|NGX_FILE_DIRECTORY
+
+#else
+#define NGX_FILE_SEARCH O_RDONLY|NGX_FILE_DIRECTORY
#endif
+#endif /* NGX_HAVE_OPENAT */
+
#define NGX_FILE_DEFAULT_ACCESS 0644
#define NGX_FILE_OWNER_ACCESS 0600