summaryrefslogtreecommitdiffstats
path: root/xlators/system
diff options
context:
space:
mode:
authorLubomir Rintel <lubo.rintel@gooddata.com>2011-12-19 23:40:11 +0100
committerAnand Avati <avati@gluster.com>2012-01-12 09:12:38 -0800
commit919e3424849db2276e003dcd919a470838bf084f (patch)
treee06f45b4e855828e7180ce0cde932f2abcecbe17 /xlators/system
parent8a78d969ee8b7c284751364d72496eec84c7290b (diff)
posix-acl: properly process umask in case client sent it
FUSE used to interpret the umask itself. That was a bad idea, since there are cases where umask is not applied, such as when extended POSIX ACLs are present and default ACLs are set on parent directory. The FUSE bridge was changed to send original mode with umask (alongside masked mode, for compatibility). If that is the case, we decide whether to apply the umask or not in the posix-acl translator depending on whether a default umask is set, or not. The original, broken, behavior is preserved in following cases: * Unpatched client (not sending umask with original mode) * Unpatched server (not understanding umask with original mode) * Old FUSE on client side (FUSE < 7.12 or linux < 2.6.31) (can not find out the umask and original mode) Change-Id: I2e3bfc4c7c9611bc51119ca5c8e28f6582677516 Signed-off-by: Lubomir Rintel <lubo.rintel@gooddata.com> Tested-by: Lubomir Rintel <lubo.rintel@gooddata.com> BUG: 765508 Reviewed-on: http://review.gluster.com/668 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@gluster.com>
Diffstat (limited to 'xlators/system')
-rw-r--r--xlators/system/posix-acl/src/posix-acl.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/xlators/system/posix-acl/src/posix-acl.c b/xlators/system/posix-acl/src/posix-acl.c
index 7acd1b5..9a425ff 100644
--- a/xlators/system/posix-acl/src/posix-acl.c
+++ b/xlators/system/posix-acl/src/posix-acl.c
@@ -552,8 +552,21 @@ posix_acl_inherit (xlator_t *this, loc_t *loc, dict_t *params, mode_t mode,
int size_default = 0;
int size_access = 0;
mode_t retmode = 0;
+ int16_t tmp_mode = 0;
+ mode_t client_umask = 0;
retmode = mode;
+ ret = dict_get_int16 (params, "umask", &tmp_mode);
+ if (ret == 0) {
+ client_umask = (mode_t)tmp_mode;
+ ret = dict_get_int16 (params, "mode", &tmp_mode);
+ if (ret == 0) {
+ retmode = (mode_t)tmp_mode;
+ } else {
+ gf_log (this->name, GF_LOG_ERROR,
+ "client sent umask, but not the original mode");
+ }
+ }
ret = posix_acl_get (loc->parent, this, NULL, &par_default);
@@ -566,7 +579,8 @@ posix_acl_inherit (xlator_t *this, loc_t *loc, dict_t *params, mode_t mode,
if (!acl_access)
goto out;
- retmode = posix_acl_inherit_mode (acl_access, mode);
+ client_umask = 0; // No umask if we inherit an ACL
+ retmode = posix_acl_inherit_mode (acl_access, retmode);
ctx->perm = retmode;
size_access = posix_acl_to_xattr (this, acl_access, NULL, 0);
@@ -615,6 +629,8 @@ set:
goto out;
out:
+ retmode &= ~client_umask;
+
if (par_default)
posix_acl_unref (this, par_default);
if (acl_access)