aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxim Dounin <mdounin@mdounin.ru>2016-10-07 16:59:14 +0300
committerMaxim Dounin <mdounin@mdounin.ru>2016-10-07 16:59:14 +0300
commit4c4fdc475450d4faa5a996ff0087ef005ee8a232 (patch)
tree7752a94eaf758ece98086296c11850f6c14dde62 /src
parent52892835ef16ea15a77e2407099e0de0dfcc8a28 (diff)
downloadnginx-4c4fdc475450d4faa5a996ff0087ef005ee8a232.tar.gz
nginx-4c4fdc475450d4faa5a996ff0087ef005ee8a232.zip
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 (limited to 'src')
-rw-r--r--src/core/ngx_file.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/core/ngx_file.c b/src/core/ngx_file.c
index c1137ccc0..8359c0fee 100644
--- 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, ngx_command_t *cmd, void *conf)
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, ngx_command_t *cmd, void *conf)
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, ngx_command_t *cmd, void *conf)
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, ngx_command_t *cmd, void *conf)
*access |= right << shift;
}
+ *access |= user;
+
return NGX_CONF_OK;
invalid: