Welcome! Log In Create A New Profile

Advanced

[nginx] Improved check for duplicate path names in ngx_add_path().

Valentin Bartenev
September 16, 2013 11:08AM
details: http://hg.nginx.org/nginx/rev/cec155f07c84
branches:
changeset: 5377:cec155f07c84
user: Valentin Bartenev <vbart@nginx.com>
date: Mon Sep 16 18:49:23 2013 +0400
description:
Improved check for duplicate path names in ngx_add_path().

The same path names with different "data" context should not be allowed.

In particular it rejects configurations like this:

proxy_cache_path /var/cache/ keys_zone=one:10m max_size=1g inactive=5m;
proxy_cache_path /var/cache/ keys_zone=two:20m max_size=4m inactive=30s;

diffstat:

src/core/ngx_file.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)

diffs (18 lines):

diff -r dd9cb4edf499 -r cec155f07c84 src/core/ngx_file.c
--- a/src/core/ngx_file.c Mon Sep 16 18:49:22 2013 +0400
+++ b/src/core/ngx_file.c Mon Sep 16 18:49:23 2013 +0400
@@ -501,6 +501,14 @@ ngx_add_path(ngx_conf_t *cf, ngx_path_t
if (p[i]->name.len == path->name.len
&& ngx_strcmp(p[i]->name.data, path->name.data) == 0)
{
+ if (p[i]->data != path->data) {
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+ "the same path name \"%V\" "
+ "used in %s:%ui and",
+ &p[i]->name, p[i]->conf_file, p[i]->line);
+ return NGX_ERROR;
+ }
+
for (n = 0; n < 3; n++) {
if (p[i]->level[n] != path->level[n]) {
if (path->conf_file == NULL) {

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

[nginx] Improved check for duplicate path names in ngx_add_path().

Valentin Bartenev 892 September 16, 2013 11:08AM



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

Online Users

Guests: 154
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready