From 9e3a0791c0f1f336e55672b24721154bc862456b Mon Sep 17 00:00:00 2001 From: Poornima G Date: Wed, 9 Mar 2016 04:05:20 -0500 Subject: fuse: Address the review comments in the backport Backport @ http://review.gluster.org/#/c/13626/3 Fix a typo error, consolidate the selinux and capability check in getxattr and setxattr. Change-Id: I4303de3d4dd00853169b07577311e03cbb912ed7 BUG: 1316327 Signed-off-by: Poornima G Reviewed-on: http://review.gluster.org/13653 NetBSD-regression: NetBSD Build System Tested-by: Vijay Bellur Smoke: Gluster Build System CentOS-regression: Gluster Build System Reviewed-by: Vijay Bellur --- xlators/mount/fuse/src/fuse-helpers.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'xlators/mount/fuse/src/fuse-helpers.c') diff --git a/xlators/mount/fuse/src/fuse-helpers.c b/xlators/mount/fuse/src/fuse-helpers.c index 0f8abf03d32..3ccd46efaeb 100644 --- a/xlators/mount/fuse/src/fuse-helpers.c +++ b/xlators/mount/fuse/src/fuse-helpers.c @@ -652,3 +652,29 @@ fuse_ignore_xattr_set (fuse_private_t *priv, char *key) return ret; } + +int +fuse_check_selinux_cap_xattr (fuse_private_t *priv, char *name) +{ + int ret = -1; + + if (strcmp (name, "security.selinux") && + strcmp (name, "security.capability")) { + /* if xattr name is not of interest, no validations needed */ + ret = 0; + goto out; + } + + if ((strcmp (name, "security.selinux") == 0) && + (priv->selinux)) { + ret = 0; + } + + if ((strcmp (name, "security.capability") == 0) && + ((priv->capability) || (priv->selinux))) { + ret = 0; + } + +out: + return ret; +} -- cgit