Mercurial > trustbridge
diff common/portpath.c @ 1070:f110a3f6e387
(issue114) Fine tune ACL propagation
using mkdir_p the ACL of the parent directories would
propagate to all subdirectories and objects in the directory.
Now we only use ACL propagation in the last directory to make
sure that files we might create in that directory inherit the
correct (resitricted) ACL
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Wed, 10 Sep 2014 16:41:36 +0200 |
parents | 66f6361fba1b |
children | fd7d04bb37cb |
line wrap: on
line diff
--- a/common/portpath.c Wed Sep 10 16:31:49 2014 +0200 +++ b/common/portpath.c Wed Sep 10 16:41:36 2014 +0200 @@ -8,6 +8,7 @@ #include "portpath.h" #include "strhelp.h" #include "util.h" +#include "logging.h" #include <libgen.h> #include <limits.h> @@ -39,9 +40,13 @@ } bool -port_mkdir(const char *path) +port_mkdir(const char *path, bool propagate_acl) { #ifndef _WIN32 + if (propagate_acl) + { + DEBUGPRINTF("WARNING: ACL propagation only has an effect on Windows.\n"); + } return mkdir(path, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) == 0; #else wchar_t *wchar_path = utf8_to_wchar(path, strlen(path)); @@ -51,7 +56,7 @@ { return false; } - ret = create_restricted_directory (wchar_path); + ret = create_restricted_directory (wchar_path, propagate_acl); xfree (wchar_path); return ret; #endif @@ -90,7 +95,7 @@ } bool -port_mkdir_p(const char *path) +port_mkdir_p(const char *path, bool propagate_acl) { char *parent_path, *p; @@ -113,9 +118,9 @@ *p = '\0'; if (!port_isdir(parent_path)) { - port_mkdir_p(parent_path); + port_mkdir_p(parent_path, false); } - return port_mkdir(path); + return port_mkdir(path, propagate_acl); } bool