Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nginx/nginx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2007-01-29 15:25:44 +0300
committerIgor Sysoev <igor@sysoev.ru>2007-01-29 15:25:44 +0300
commite31625b60e75ddbbc51e8dd282cdbb46c6506185 (patch)
tree994e0ecb2a770c57a98346c432f7a35046abefde /src
parente99305be7af552d645037e5a7974995102a8329b (diff)
use ngx_dir_access() to enable search bits for directory
Diffstat (limited to 'src')
-rw-r--r--src/http/modules/ngx_http_dav_module.c16
-rw-r--r--src/os/unix/ngx_files.h3
-rw-r--r--src/os/win32/ngx_files.h3
3 files changed, 15 insertions, 7 deletions
diff --git a/src/http/modules/ngx_http_dav_module.c b/src/http/modules/ngx_http_dav_module.c
index 5a2f0cacb..f46cfe15d 100644
--- a/src/http/modules/ngx_http_dav_module.c
+++ b/src/http/modules/ngx_http_dav_module.c
@@ -252,7 +252,9 @@ ngx_http_dav_handler(ngx_http_request_t *r)
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"http mkcol path: \"%s\"", path.data);
- if (ngx_create_dir(path.data, dlcf->access) != NGX_FILE_ERROR) {
+ if (ngx_create_dir(path.data, ngx_dir_access(dlcf->access))
+ != NGX_FILE_ERROR)
+ {
if (ngx_http_dav_location(r, path.data) != NGX_OK) {
return NGX_HTTP_INTERNAL_SERVER_ERROR;
}
@@ -351,7 +353,7 @@ ngx_http_dav_put_handler(ngx_http_request_t *r)
#if !(NGX_WIN32)
- if (ngx_change_file_access(temp->data, dlcf->access & ~0111)
+ if (ngx_change_file_access(temp->data, dlcf->access)
== NGX_FILE_ERROR)
{
err = ngx_errno;
@@ -393,7 +395,7 @@ ngx_http_dav_put_handler(ngx_http_request_t *r)
if (err == NGX_ENOENT) {
if (dlcf->create_full_put_path) {
- err = ngx_create_full_path(path.data, dlcf->access);
+ err = ngx_create_full_path(path.data, ngx_dir_access(dlcf->access));
if (err == 0) {
if (ngx_rename_file(temp->data, path.data) != NGX_FILE_ERROR) {
@@ -539,7 +541,7 @@ ngx_http_dav_access(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
value = cf->args->elts;
- lcf->access = 0700;
+ lcf->access = 0600;
for (i = 1; i < cf->args->nelts; i++) {
@@ -562,16 +564,16 @@ ngx_http_dav_access(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
}
if (ngx_strcmp(p, "rw") == 0) {
- right = 7;
+ right = 6;
} else if (ngx_strcmp(p, "r") == 0) {
- right = 5;
+ right = 4;
} else {
goto invalid;
}
- lcf->access += right << shift;
+ lcf->access |= right << shift;
}
return NGX_CONF_OK;
diff --git a/src/os/unix/ngx_files.h b/src/os/unix/ngx_files.h
index d4ad8a467..aa7311d72 100644
--- a/src/os/unix/ngx_files.h
+++ b/src/os/unix/ngx_files.h
@@ -122,6 +122,9 @@ ngx_int_t ngx_open_dir(ngx_str_t *name, ngx_dir_t *dir);
#define ngx_delete_dir_n "rmdir()"
+#define ngx_dir_access(a) (a | (a & 0444) >> 2)
+
+
#define ngx_de_name(dir) ((u_char *) (dir)->de->d_name)
#if (NGX_FREEBSD)
#define ngx_de_namelen(dir) (dir)->de->d_namlen
diff --git a/src/os/win32/ngx_files.h b/src/os/win32/ngx_files.h
index 96e0c8d44..adcaab3d4 100644
--- a/src/os/win32/ngx_files.h
+++ b/src/os/win32/ngx_files.h
@@ -150,6 +150,9 @@ ngx_int_t ngx_read_dir(ngx_dir_t *dir);
#define ngx_delete_dir_n "RemoveDirectory()"
+#define ngx_dir_access(a) (a)
+
+
#define ngx_de_name(dir) ((u_char *) (dir)->finddata.cFileName)
#define ngx_de_namelen(dir) ngx_strlen((dir)->finddata.cFileName)