Welcome! Log In Create A New Profile

Advanced

[nginx] svn commit: r4494 - trunk/src/core

Anonymous User
February 27, 2012 11:48AM
Author: vbart
Date: 2012-02-27 16:46:57 +0000 (Mon, 27 Feb 2012)
New Revision: 4494

Modified:
trunk/src/core/ngx_open_file_cache.c
trunk/src/core/ngx_open_file_cache.h
Log:
Disable symlinks: added the "from" parameter support to the open file cache.


Modified: trunk/src/core/ngx_open_file_cache.c
===================================================================
--- trunk/src/core/ngx_open_file_cache.c 2012-02-27 16:23:44 UTC (rev 4493)
+++ trunk/src/core/ngx_open_file_cache.c 2012-02-27 16:46:57 UTC (rev 4494)
@@ -229,6 +229,7 @@
&& now - file->created < of->valid
#if (NGX_HAVE_OPENAT)
&& of->disable_symlinks == file->disable_symlinks
+ && of->disable_symlinks_from == file->disable_symlinks_from
#endif
))
{
@@ -395,6 +396,7 @@
file->err = of->err;
#if (NGX_HAVE_OPENAT)
file->disable_symlinks = of->disable_symlinks;
+ file->disable_symlinks_from = of->disable_symlinks_from;
#endif

if (of->err == 0) {
@@ -583,7 +585,28 @@

at_name = *name;

- if (*p == '/') {
+ if (of->disable_symlinks_from) {
+
+ cp = p + of->disable_symlinks_from;
+
+ *cp = '\0';
+
+ at_fd = ngx_open_file(p, NGX_FILE_SEARCH|NGX_FILE_NONBLOCK,
+ NGX_FILE_OPEN, 0);
+
+ *cp = '/';
+
+ if (at_fd == NGX_INVALID_FILE) {
+ of->err = ngx_errno;
+ of->failed = ngx_open_file_n;
+ return NGX_INVALID_FILE;
+ }
+
+ at_name.len = of->disable_symlinks_from;
+ p = cp + 1;
+
+ } else if (*p == '/') {
+
at_fd = ngx_open_file("/",
NGX_FILE_SEARCH|NGX_FILE_NONBLOCK,
NGX_FILE_OPEN, 0);

Modified: trunk/src/core/ngx_open_file_cache.h
===================================================================
--- trunk/src/core/ngx_open_file_cache.h 2012-02-27 16:23:44 UTC (rev 4493)
+++ trunk/src/core/ngx_open_file_cache.h 2012-02-27 16:46:57 UTC (rev 4494)
@@ -33,6 +33,7 @@
ngx_uint_t min_uses;

#if (NGX_HAVE_OPENAT)
+ size_t disable_symlinks_from;
unsigned disable_symlinks:2;
#endif

@@ -69,6 +70,7 @@
uint32_t uses;

#if (NGX_HAVE_OPENAT)
+ size_t disable_symlinks_from;
unsigned disable_symlinks:2;
#endif


_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] svn commit: r4494 - trunk/src/core

Anonymous User 1238 February 27, 2012 11:48AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 183
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready