summaryrefslogtreecommitdiffstats
path: root/xlators/storage/posix/src/posix.c
diff options
context:
space:
mode:
authorKotresh HR <khiremat@redhat.com>2017-07-10 10:31:27 -0400
committerJeff Darcy <jeff@pl.atyp.us>2017-07-24 13:05:48 +0000
commit96eece8abbb9c06f0b91f37e718ac9e337a3f714 (patch)
treec5d3498254327ef314ae29c038592ae35df22387 /xlators/storage/posix/src/posix.c
parent668df4e7e452aa26f0e0fbd15691fab0edc83014 (diff)
posix/gfid2path: Block access to gfid2path xattr via mount
gfid2path xattr is an internal xattr and should not be allowed to modify by other applications via gluster mount. This patch blocks the same. Updates: #139 Change-Id: Id2cb29797ee1bd77e0e0d2203a47469fd7203355 Signed-off-by: Kotresh HR <khiremat@redhat.com> Reviewed-on: https://review.gluster.org/17744 Smoke: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Prashanth Pai <ppai@redhat.com> Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com> Reviewed-by: Aravinda VK <avishwan@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Diffstat (limited to 'xlators/storage/posix/src/posix.c')
-rw-r--r--xlators/storage/posix/src/posix.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
index e8ef510ea07..dc8a129cacb 100644
--- a/xlators/storage/posix/src/posix.c
+++ b/xlators/storage/posix/src/posix.c
@@ -4516,6 +4516,12 @@ posix_getxattr (call_frame_t *frame, xlator_t *this,
goto out;
}
+ if (name && posix_is_gfid2path_xattr (name)) {
+ op_ret = -1;
+ op_errno = ENOATTR;
+ goto out;
+ }
+
if (loc->inode && IA_ISDIR(loc->inode->ia_type) && name &&
ZR_FILE_CONTENT_REQUEST(name)) {
ret = posix_get_file_contents (this, loc->gfid, &name[15],
@@ -4862,6 +4868,11 @@ posix_getxattr (call_frame_t *frame, xlator_t *this,
_gf_false);
if (ret == -1)
goto ignore;
+
+ if (posix_is_gfid2path_xattr (keybuffer)) {
+ goto ignore;
+ }
+
memset (value_buf, '\0', sizeof(value_buf));
have_val = _gf_false;
size = sys_lgetxattr (real_path, keybuffer, value_buf,
@@ -5422,6 +5433,12 @@ posix_common_removexattr (call_frame_t *frame, loc_t *loc, fd_t *fd,
inode = fd->inode;
}
+ if (posix_is_gfid2path_xattr (name)) {
+ op_ret = -1;
+ *op_errno = ENOATTR;
+ goto out;
+ }
+
if (gf_get_index_by_elem (disallow_removexattrs, (char *)name) >= 0) {
gf_msg (this->name, GF_LOG_WARNING, 0, P_MSG_XATTR_NOT_REMOVED,
"Remove xattr called on %s for file/dir %s with gfid: "