summaryrefslogtreecommitdiffstats
path: root/xlators/system
diff options
context:
space:
mode:
authorAnand Avati <avati@redhat.com>2013-04-27 11:18:20 -0700
committerVijay Bellur <vbellur@redhat.com>2013-06-08 14:49:27 -0700
commit84277d1a3002058c7e5991f96eb5d3b635ae87fc (patch)
tree92e7219727d4ad13d5f42887b9a09f4cb3453fe0 /xlators/system
parenta7aa733d2802eee2f4f2d24eca4378997b89bfbb (diff)
posix-acl: fetch ACLs in readdirplus
Not fetching ACLs in readdirplus can potentially result in spurious wrong ACL decisions (which magically go away on a lookup() which populates the ACLs) Change-Id: Ided38b4d868fab482b477ce51b4878289ef9eed0 BUG: 953694 Signed-off-by: Anand Avati <avati@redhat.com> Reviewed-on: http://review.gluster.org/5156 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/system')
-rw-r--r--xlators/system/posix-acl/src/posix-acl.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/xlators/system/posix-acl/src/posix-acl.c b/xlators/system/posix-acl/src/posix-acl.c
index a3570c0b2bf..f067e91babe 100644
--- a/xlators/system/posix-acl/src/posix-acl.c
+++ b/xlators/system/posix-acl/src/posix-acl.c
@@ -1517,12 +1517,16 @@ posix_acl_readdirp (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
off_t offset, dict_t *dict)
{
int ret = 0;
+ dict_t *alloc_dict = NULL;
if (acl_permits (frame, fd->inode, POSIX_ACL_READ))
goto green;
else
goto red;
green:
+ if (!dict)
+ dict = alloc_dict = dict_new ();
+
if (dict) {
ret = dict_set_int8 (dict, POSIX_ACL_ACCESS_XATTR, 0);
if (ret)
@@ -1541,6 +1545,8 @@ green:
FIRST_CHILD(this), FIRST_CHILD(this)->fops->readdirp,
fd, size, offset, dict);
+ if (alloc_dict)
+ dict_unref (alloc_dict);
return 0;
red:
STACK_UNWIND_STRICT (readdirp, frame, -1, EACCES, NULL, NULL);