diff options
author | Andreas Gruenbacher <agruen@suse.de> | 2009-06-08 17:18:45 +0200 |
---|---|---|
committer | Andreas Gruenbacher <agruen@suse.de> | 2009-06-08 17:18:45 +0200 |
commit | bc37d1d438adac749de5894285f75d767ac79b0d (patch) | |
tree | 43f733b33cdf3b003b64ea43fa10db07122fe3d3 | |
parent | 45833cc34cb647ed76ecff8adf630385c1c4eee8 (diff) | |
download | acl-bc37d1d438adac749de5894285f75d767ac79b0d.tar.gz |
Fix in acl_equiv_mode: return the right mode even when the acl is not equivalent.
-rw-r--r-- | doc/CHANGES | 3 | ||||
-rw-r--r-- | libacl/acl_equiv_mode.c | 12 |
2 files changed, 12 insertions, 3 deletions
diff --git a/doc/CHANGES b/doc/CHANGES index 560d98d..666b866 100644 --- a/doc/CHANGES +++ b/doc/CHANGES @@ -1,3 +1,6 @@ +* Fix in acl_equiv_mode(): Return the mode that the acl corresponds to even + when the acl has more than three entries (i.e., it is not equivalent to + this mode). * When restoring acls and the file ownership from the output of getfacl with setfacl --restore, make sure to only chown(2) files when the owner or owning group does not match the current owner or owning group: diff --git a/libacl/acl_equiv_mode.c b/libacl/acl_equiv_mode.c index e31301f..b4c6de3 100644 --- a/libacl/acl_equiv_mode.c +++ b/libacl/acl_equiv_mode.c @@ -30,7 +30,7 @@ int acl_equiv_mode(acl_t acl, mode_t *mode_p) { acl_obj *acl_obj_p = ext2int(acl, acl); - acl_entry_obj *entry_obj_p; + acl_entry_obj *entry_obj_p, *mask_obj_p = NULL; int not_equiv = 0; mode_t mode = 0; if (!acl_obj_p) @@ -49,9 +49,11 @@ acl_equiv_mode(acl_t acl, mode_t *mode_p) mode |= (entry_obj_p->eperm.sperm & S_IRWXO); break; + case ACL_MASK: + mask_obj_p = entry_obj_p; + /* fall through */ case ACL_USER: case ACL_GROUP: - case ACL_MASK: not_equiv = 1; break; default: @@ -59,8 +61,12 @@ acl_equiv_mode(acl_t acl, mode_t *mode_p) return -1; } } - if (mode_p) + if (mode_p) { + if (mask_obj_p) + mode = (mode & ~S_IRWXG) | + ((mask_obj_p->eperm.sperm & S_IRWXO) << 3); *mode_p = mode; + } return not_equiv; } |