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-bridge.c | 36 ++++++++++-------------------------- 1 file changed, 10 insertions(+), 26 deletions(-) (limited to 'xlators/mount/fuse/src/fuse-bridge.c') diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c index d34e85fb2fd..c6c38f3145b 100644 --- a/xlators/mount/fuse/src/fuse-bridge.c +++ b/xlators/mount/fuse/src/fuse-bridge.c @@ -3236,20 +3236,11 @@ fuse_setxattr (xlator_t *this, fuse_in_header_t *finh, void *msg) } } - if (!priv->selinux) { - if (strcmp (name, "security.selinux") == 0) { - send_fuse_err (this, finh, EOPNOTSUPP); - GF_FREE (finh); - return; - } - } - - if ((!priv->capability) && (!priv->selinux)) { - if (strcmp (name, "security.capability") == 0) { - send_fuse_err (this, finh, EOPNOTSUPP); - GF_FREE (finh); - return; - } + ret = fuse_check_selinux_cap_xattr (priv, name); + if (ret) { + send_fuse_err (this, finh, EOPNOTSUPP); + GF_FREE (finh); + return; } /* Check if the command is for changing the log @@ -3543,6 +3534,7 @@ fuse_getxattr (xlator_t *this, fuse_in_header_t *finh, void *msg) int rv = 0; int op_errno = EINVAL; char *newkey = NULL; + int ret = 0; priv = this->private; GET_STATE (this, finh, state); @@ -3574,18 +3566,10 @@ fuse_getxattr (xlator_t *this, fuse_in_header_t *finh, void *msg) } } - if (!priv->selinux) { - if (strcmp (name, "security.selinux") == 0) { - op_errno = ENODATA; - goto err; - } - } - - if ((!priv->capability) && (!priv->selinux)) { - if (strcmp (name, "security.capability") == 0) { - op_errno = ENODATA; - goto err; - } + ret = fuse_check_selinux_cap_xattr (priv, name); + if (ret) { + op_errno = ENODATA; + goto err; } fuse_resolve_inode_init (state, &state->resolve, finh->nodeid); -- cgit