From 61a550b77b776145d45025467f3fa6e9040bc2e0 Mon Sep 17 00:00:00 2001 From: Brian Foster Date: Wed, 7 Mar 2012 14:56:19 -0500 Subject: 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 Reviewed-on: http://review.gluster.com/2903 Tested-by: Gluster Build System Reviewed-by: Jeff Darcy Reviewed-by: Amar Tumballi --- xlators/system/posix-acl/src/posix-acl.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'xlators/system') diff --git a/xlators/system/posix-acl/src/posix-acl.c b/xlators/system/posix-acl/src/posix-acl.c index 517af1f5b..0e92cb35f 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); -- cgit