summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorshishir gowda <shishirng@gluster.com>2011-07-05 01:56:40 +0000
committerVijay Bellur <vijay@gluster.com>2011-07-05 05:21:41 -0700
commit817fbc829cc71e323979315a8b718d188e45802c (patch)
tree034a3dc98e9e52a0eafd2b44dd34e9d0bb35ba11
parent8c0f1e3bba1bd0c0159f2ab363aa6039d3a6a20a (diff)
access-control: Return mode part of NFS access control request
Signed-off-by: shishir gowda <shishirng@gluster.com> Signed-off-by: Vijay Bellur <vijay@gluster.com> BUG: 3057 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=3057
-rw-r--r--xlators/system/posix-acl/src/posix-acl.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/xlators/system/posix-acl/src/posix-acl.c b/xlators/system/posix-acl/src/posix-acl.c
index f05ed3f..3cd8c48 100644
--- a/xlators/system/posix-acl/src/posix-acl.c
+++ b/xlators/system/posix-acl/src/posix-acl.c
@@ -221,19 +221,26 @@ mask_check:
for (i = 0; i < acl->count; i++, ace++) {
if (ace->tag != POSIX_ACL_MASK)
continue;
- if ((ace->perm & perm & want) == want)
+ if ((ace->perm & perm & want) == want) {
+ verdict = ace->perm & perm;
goto green;
+ }
goto red;
}
perm_check:
- if ((perm & want) == want)
+ if ((perm & want) == want) {
+ verdict = perm & want;
goto green;
- else
+ } else {
goto red;
+ }
green:
- verdict = 1;
+ if (!want)
+ verdict = 1;
+ if (!verdict)
+ verdict = want;
goto out;
red:
verdict = 0;
@@ -759,7 +766,7 @@ posix_acl_access (call_frame_t *frame, xlator_t *this, loc_t *loc, int mask)
int op_ret = 0;
int op_errno = 0;
int perm = 0;
-
+ int mode = 0;
if (mask & R_OK)
perm |= POSIX_ACL_READ;
@@ -773,7 +780,8 @@ posix_acl_access (call_frame_t *frame, xlator_t *this, loc_t *loc, int mask)
goto unwind;
}
- if (acl_permits (frame, loc->inode, perm)) {
+ mode = acl_permits (frame, loc->inode, perm);
+ if (mode) {
op_ret = 0;
op_errno = 0;
} else {
@@ -782,8 +790,10 @@ posix_acl_access (call_frame_t *frame, xlator_t *this, loc_t *loc, int mask)
}
unwind:
- STACK_UNWIND_STRICT (access, frame, op_ret, op_errno);
-
+ if (__is_fuse_call (frame))
+ STACK_UNWIND_STRICT (access, frame, op_ret, op_errno);
+ else
+ STACK_UNWIND_STRICT (access, frame, 0, mode);
return 0;
}