summaryrefslogtreecommitdiffstats
path: root/xlators/system/posix-acl
diff options
context:
space:
mode:
authorAnand Avati <avati@redhat.com>2013-04-27 11:18:20 -0700
committerVijay Bellur <vbellur@redhat.com>2013-05-02 23:16:09 -0700
commitaec246459b4c82fd666a3de20a55700008a5f831 (patch)
treea61024384fdb9841f3c6f575567089703228cf2c /xlators/system/posix-acl
parentb224d7ffb88c274ef0a65d4b5d30b2ce320c6200 (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/4926 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/system/posix-acl')
-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 05d65f3d9b4..f6246d92c8a 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);