diff options
author | vmallika <vmallika@redhat.com> | 2016-04-02 12:02:22 +0530 |
---|---|---|
committer | Vijaikumar Mallikarjuna <vmallika@redhat.com> | 2016-04-06 05:08:26 -0700 |
commit | 1546572b7d46c1aee906608140c843160a529937 (patch) | |
tree | 6870c8fc4f89475281bcf1825423571b6e87d5cd /xlators/system/posix-acl/src/posix-acl.c | |
parent | 7927149f71adc49cad92f28f805a8e688534156e (diff) |
posix_acl: skip acl_permits for special clients
Change-Id: I3f478b7e4ecab517200f50eb09f65a634c029437
BUG: 1320818
Signed-off-by: vmallika <vmallika@redhat.com>
Reviewed-on: http://review.gluster.org/13894
Smoke: Gluster Build System <jenkins@build.gluster.com>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: jiffin tony Thottan <jthottan@redhat.com>
CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'xlators/system/posix-acl/src/posix-acl.c')
-rw-r--r-- | xlators/system/posix-acl/src/posix-acl.c | 39 |
1 files changed, 28 insertions, 11 deletions
diff --git a/xlators/system/posix-acl/src/posix-acl.c b/xlators/system/posix-acl/src/posix-acl.c index 61d2d6647f6..688e60914dc 100644 --- a/xlators/system/posix-acl/src/posix-acl.c +++ b/xlators/system/posix-acl/src/posix-acl.c @@ -158,11 +158,16 @@ sticky_permits (call_frame_t *frame, inode_t *parent, inode_t *inode) struct posix_acl_ctx *par = NULL; struct posix_acl_ctx *ctx = NULL; + if ((0 > frame->root->pid) || frame_is_super_user (frame)) + return 1; + par = posix_acl_ctx_get (parent, frame->this); - ctx = posix_acl_ctx_get (inode, frame->this); + if (par == NULL) + return 0; - if (frame_is_super_user (frame)) - return 1; + ctx = posix_acl_ctx_get (inode, frame->this); + if (ctx == NULL) + return 0; if (!(par->perm & S_ISVTX)) return 1; @@ -192,16 +197,12 @@ acl_permits (call_frame_t *frame, inode_t *inode, int want) conf = frame->this->private; + if ((0 > frame->root->pid) || frame_is_super_user (frame)) + goto green; + ctx = posix_acl_ctx_get (inode, frame->this); - if (!ctx) { - gf_log_callingfn (frame->this->name, GF_LOG_ERROR, - "inode ctx is NULL for %s", - uuid_utoa (inode->gfid)); + if (!ctx) goto red; - } - - if (frame_is_super_user (frame)) - goto green; posix_acl_get (inode, frame->this, &acl, NULL); if (!acl) { @@ -318,12 +319,20 @@ posix_acl_ctx_new (inode_t *inode, xlator_t *this) { struct posix_acl_ctx *ctx = NULL; + if (inode == NULL) { + gf_log_callingfn (this->name, GF_LOG_WARNING, "inode is NULL"); + return NULL; + } + LOCK (&inode->lock); { ctx = __posix_acl_ctx_get (inode, this, _gf_true); } UNLOCK (&inode->lock); + if (ctx == NULL) + gf_log_callingfn (this->name, GF_LOG_ERROR, "creating inode ctx" + "failed for %s", uuid_utoa (inode->gfid)); return ctx; } @@ -332,12 +341,20 @@ posix_acl_ctx_get (inode_t *inode, xlator_t *this) { struct posix_acl_ctx *ctx = NULL; + if (inode == NULL) { + gf_log_callingfn (this->name, GF_LOG_WARNING, "inode is NULL"); + return NULL; + } + LOCK (&inode->lock); { ctx = __posix_acl_ctx_get (inode, this, _gf_false); } UNLOCK (&inode->lock); + if (ctx == NULL) + gf_log_callingfn (this->name, GF_LOG_ERROR, "inode ctx is NULL " + "for %s", uuid_utoa (inode->gfid)); return ctx; } |