diff options
author | Brian Foster <bfoster@redhat.com> | 2012-03-07 14:56:19 -0500 |
---|---|---|
committer | Vijay Bellur <vijay@gluster.com> | 2012-03-14 02:16:36 -0700 |
commit | 61a550b77b776145d45025467f3fa6e9040bc2e0 (patch) | |
tree | e2ac804fb65217f43cd8f55f29865231da7187d0 /xlators | |
parent | fa5b0347193f8d1a4b917a2edb338423cb175e66 (diff) |
system/posix-acl: fix acl inode assignment in posix_acl_readdirp_cbk
If an entry includes no ACL returned via dictionary, it is possible
to skip down to acl_set without updating acl_access and/or
acl_default. If either are set from the previous iteration, the
unrelated ACLs are set to the current entry. Use a single set of
pointers to ensure that valid ACLs are always set.
Change-Id: Ia94887ded91845bc39d4d5e95ef00d190681e517
BUG: 801183
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-on: http://review.gluster.com/2903
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/system/posix-acl/src/posix-acl.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/xlators/system/posix-acl/src/posix-acl.c b/xlators/system/posix-acl/src/posix-acl.c index 517af1f5bc9..0e92cb35f31 100644 --- a/xlators/system/posix-acl/src/posix-acl.c +++ b/xlators/system/posix-acl/src/posix-acl.c @@ -1430,8 +1430,6 @@ posix_acl_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this, gf_dirent_t *entry = NULL; struct posix_acl *acl_access = NULL; struct posix_acl *acl_default = NULL; - struct posix_acl *old_access = NULL; - struct posix_acl *old_default = NULL; data_t *data = NULL; int ret = 0; @@ -1444,16 +1442,16 @@ posix_acl_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this, continue; ret = posix_acl_get (entry->inode, this, - &old_access, &old_default); + &acl_access, &acl_default); data = dict_get (entry->dict, POSIX_ACL_ACCESS_XATTR); if (!data) goto acl_default; - if (old_access && - posix_acl_matches_xattr (this, old_access, data->data, + if (acl_access && + posix_acl_matches_xattr (this, acl_access, data->data, data->len)) { - acl_access = posix_acl_ref (this, old_access); + acl_access = posix_acl_ref (this, acl_access); } else { acl_access = posix_acl_from_xattr (this, data->data, data->len); @@ -1464,10 +1462,10 @@ posix_acl_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (!data) goto acl_set; - if (old_default && - posix_acl_matches_xattr (this, old_default, data->data, + if (acl_default && + posix_acl_matches_xattr (this, acl_default, data->data, data->len)) { - acl_default = posix_acl_ref (this, old_default); + acl_default = posix_acl_ref (this, acl_default); } else { acl_default = posix_acl_from_xattr (this, data->data, data->len); |