|
|
12a457 |
From 4eacfb3a1212f71958d371404a47416d30601831 Mon Sep 17 00:00:00 2001
|
|
|
12a457 |
From: vmallika <vmallika@redhat.com>
|
|
|
12a457 |
Date: Sat, 2 Apr 2016 12:02:22 +0530
|
|
|
12a457 |
Subject: [PATCH 55/80] posix_acl: skip acl_permits for special clients
|
|
|
12a457 |
|
|
|
12a457 |
This is a backport of http://review.gluster.org/13894
|
|
|
12a457 |
|
|
|
12a457 |
> Change-Id: I3f478b7e4ecab517200f50eb09f65a634c029437
|
|
|
12a457 |
> BUG: 1320818
|
|
|
12a457 |
> Signed-off-by: vmallika <vmallika@redhat.com>
|
|
|
12a457 |
> Reviewed-on: http://review.gluster.org/13894
|
|
|
12a457 |
> Smoke: Gluster Build System <jenkins@build.gluster.com>
|
|
|
12a457 |
> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
|
|
|
12a457 |
> Reviewed-by: jiffin tony Thottan <jthottan@redhat.com>
|
|
|
12a457 |
> CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
|
|
|
12a457 |
|
|
|
12a457 |
Change-Id: Ic0ffefae00d498631c2212dd69d818a9e5787d38
|
|
|
12a457 |
BUG: 1302355
|
|
|
12a457 |
Signed-off-by: vmallika <vmallika@redhat.com>
|
|
|
12a457 |
Reviewed-on: https://code.engineering.redhat.com/gerrit/71538
|
|
|
12a457 |
Reviewed-by: Raghavendra Gowdappa <rgowdapp@redhat.com>
|
|
|
12a457 |
Tested-by: Raghavendra Gowdappa <rgowdapp@redhat.com>
|
|
|
12a457 |
---
|
|
|
12a457 |
xlators/system/posix-acl/src/posix-acl.c | 39 +++++++++++++++++++++--------
|
|
|
12a457 |
1 files changed, 28 insertions(+), 11 deletions(-)
|
|
|
12a457 |
|
|
|
12a457 |
diff --git a/xlators/system/posix-acl/src/posix-acl.c b/xlators/system/posix-acl/src/posix-acl.c
|
|
|
12a457 |
index 1ec3144..3ebdca4 100644
|
|
|
12a457 |
--- a/xlators/system/posix-acl/src/posix-acl.c
|
|
|
12a457 |
+++ b/xlators/system/posix-acl/src/posix-acl.c
|
|
|
12a457 |
@@ -158,11 +158,16 @@ sticky_permits (call_frame_t *frame, inode_t *parent, inode_t *inode)
|
|
|
12a457 |
struct posix_acl_ctx *par = NULL;
|
|
|
12a457 |
struct posix_acl_ctx *ctx = NULL;
|
|
|
12a457 |
|
|
|
12a457 |
+ if ((0 > frame->root->pid) || frame_is_super_user (frame))
|
|
|
12a457 |
+ return 1;
|
|
|
12a457 |
+
|
|
|
12a457 |
par = posix_acl_ctx_get (parent, frame->this);
|
|
|
12a457 |
- ctx = posix_acl_ctx_get (inode, frame->this);
|
|
|
12a457 |
+ if (par == NULL)
|
|
|
12a457 |
+ return 0;
|
|
|
12a457 |
|
|
|
12a457 |
- if (frame_is_super_user (frame))
|
|
|
12a457 |
- return 1;
|
|
|
12a457 |
+ ctx = posix_acl_ctx_get (inode, frame->this);
|
|
|
12a457 |
+ if (ctx == NULL)
|
|
|
12a457 |
+ return 0;
|
|
|
12a457 |
|
|
|
12a457 |
if (!(par->perm & S_ISVTX))
|
|
|
12a457 |
return 1;
|
|
|
12a457 |
@@ -192,16 +197,12 @@ acl_permits (call_frame_t *frame, inode_t *inode, int want)
|
|
|
12a457 |
|
|
|
12a457 |
conf = frame->this->private;
|
|
|
12a457 |
|
|
|
12a457 |
+ if ((0 > frame->root->pid) || frame_is_super_user (frame))
|
|
|
12a457 |
+ goto green;
|
|
|
12a457 |
+
|
|
|
12a457 |
ctx = posix_acl_ctx_get (inode, frame->this);
|
|
|
12a457 |
- if (!ctx) {
|
|
|
12a457 |
- gf_log_callingfn (frame->this->name, GF_LOG_ERROR,
|
|
|
12a457 |
- "inode ctx is NULL for %s",
|
|
|
12a457 |
- uuid_utoa (inode->gfid));
|
|
|
12a457 |
+ if (!ctx)
|
|
|
12a457 |
goto red;
|
|
|
12a457 |
- }
|
|
|
12a457 |
-
|
|
|
12a457 |
- if (frame_is_super_user (frame))
|
|
|
12a457 |
- goto green;
|
|
|
12a457 |
|
|
|
12a457 |
posix_acl_get (inode, frame->this, &acl, NULL);
|
|
|
12a457 |
if (!acl) {
|
|
|
12a457 |
@@ -318,12 +319,20 @@ posix_acl_ctx_new (inode_t *inode, xlator_t *this)
|
|
|
12a457 |
{
|
|
|
12a457 |
struct posix_acl_ctx *ctx = NULL;
|
|
|
12a457 |
|
|
|
12a457 |
+ if (inode == NULL) {
|
|
|
12a457 |
+ gf_log_callingfn (this->name, GF_LOG_WARNING, "inode is NULL");
|
|
|
12a457 |
+ return NULL;
|
|
|
12a457 |
+ }
|
|
|
12a457 |
+
|
|
|
12a457 |
LOCK (&inode->lock);
|
|
|
12a457 |
{
|
|
|
12a457 |
ctx = __posix_acl_ctx_get (inode, this, _gf_true);
|
|
|
12a457 |
}
|
|
|
12a457 |
UNLOCK (&inode->lock);
|
|
|
12a457 |
|
|
|
12a457 |
+ if (ctx == NULL)
|
|
|
12a457 |
+ gf_log_callingfn (this->name, GF_LOG_ERROR, "creating inode ctx"
|
|
|
12a457 |
+ "failed for %s", uuid_utoa (inode->gfid));
|
|
|
12a457 |
return ctx;
|
|
|
12a457 |
}
|
|
|
12a457 |
|
|
|
12a457 |
@@ -332,12 +341,20 @@ posix_acl_ctx_get (inode_t *inode, xlator_t *this)
|
|
|
12a457 |
{
|
|
|
12a457 |
struct posix_acl_ctx *ctx = NULL;
|
|
|
12a457 |
|
|
|
12a457 |
+ if (inode == NULL) {
|
|
|
12a457 |
+ gf_log_callingfn (this->name, GF_LOG_WARNING, "inode is NULL");
|
|
|
12a457 |
+ return NULL;
|
|
|
12a457 |
+ }
|
|
|
12a457 |
+
|
|
|
12a457 |
LOCK (&inode->lock);
|
|
|
12a457 |
{
|
|
|
12a457 |
ctx = __posix_acl_ctx_get (inode, this, _gf_false);
|
|
|
12a457 |
}
|
|
|
12a457 |
UNLOCK (&inode->lock);
|
|
|
12a457 |
|
|
|
12a457 |
+ if (ctx == NULL)
|
|
|
12a457 |
+ gf_log_callingfn (this->name, GF_LOG_ERROR, "inode ctx is NULL "
|
|
|
12a457 |
+ "for %s", uuid_utoa (inode->gfid));
|
|
|
12a457 |
return ctx;
|
|
|
12a457 |
}
|
|
|
12a457 |
|
|
|
12a457 |
--
|
|
|
12a457 |
1.7.1
|
|
|
12a457 |
|