Welcome! Log In Create A New Profile

Advanced

[nginx] Core: ngx_conf_set_access_slot() user access (ticket #1096).

Maxim Dounin
October 07, 2016 12:20PM
details: http://hg.nginx.org/nginx/rev/1606a817c1d4
branches:
changeset: 6730:1606a817c1d4
user: Maxim Dounin <mdounin@mdounin.ru>
date: Fri Oct 07 16:59:14 2016 +0300
description:
Core: ngx_conf_set_access_slot() user access (ticket #1096).

Previously, user access bits were always set to "rw" unconditionally,
even with "user:r" explicitly specified. With this change we only add
default user access bits (0600) if they weren't set explicitly.

diffstat:

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

diffs (39 lines):

diff --git a/src/core/ngx_file.c b/src/core/ngx_file.c
--- a/src/core/ngx_file.c
+++ b/src/core/ngx_file.c
@@ -441,7 +441,7 @@ ngx_conf_set_access_slot(ngx_conf_t *cf,

u_char *p;
ngx_str_t *value;
- ngx_uint_t i, right, shift, *access;
+ ngx_uint_t i, right, shift, *access, user;

access = (ngx_uint_t *) (confp + cmd->offset);

@@ -451,7 +451,8 @@ ngx_conf_set_access_slot(ngx_conf_t *cf,

value = cf->args->elts;

- *access = 0600;
+ *access = 0;
+ user = 0600;

for (i = 1; i < cf->args->nelts; i++) {

@@ -460,6 +461,7 @@ ngx_conf_set_access_slot(ngx_conf_t *cf,
if (ngx_strncmp(p, "user:", sizeof("user:") - 1) == 0) {
shift = 6;
p += sizeof("user:") - 1;
+ user = 0;

} else if (ngx_strncmp(p, "group:", sizeof("group:") - 1) == 0) {
shift = 3;
@@ -486,6 +488,8 @@ ngx_conf_set_access_slot(ngx_conf_t *cf,
*access |= right << shift;
}

+ *access |= user;
+
return NGX_CONF_OK;

invalid:

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

[nginx] Core: ngx_conf_set_access_slot() user access (ticket #1096).

Maxim Dounin 407 October 07, 2016 12:20PM



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

Online Users

Guests: 160
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