From 21f7ad207bdb8ddf549aa65cafc1ad95e261ec3d Mon Sep 17 00:00:00 2001 From: Vijaykumar M Date: Tue, 26 Nov 2013 18:01:17 +0530 Subject: posix: do not allow to set/get "trusted.glusterfs.volume-id" xattr Change-Id: I2e9a2264b1fd5ebc1ed0aff30225e89acbd0bcb4 BUG: 1034716 Signed-off-by: Vijaykumar M Reviewed-on: http://review.gluster.org/6361 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- xlators/storage/posix/src/posix.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'xlators/storage') diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index 2616885ee..b72cd5e0f 100644 --- a/xlators/storage/posix/src/posix.c +++ b/xlators/storage/posix/src/posix.c @@ -2943,6 +2943,7 @@ posix_setxattr (call_frame_t *frame, xlator_t *this, op_ret = -1; dict_del (dict, GFID_XATTR_KEY); + dict_del (dict, GF_XATTR_VOL_ID_KEY); filler.real_path = real_path; filler.this = this; @@ -3667,6 +3668,7 @@ done: if (dict) { dict_del (dict, GFID_XATTR_KEY); + dict_del (dict, GF_XATTR_VOL_ID_KEY); } out: @@ -3852,6 +3854,7 @@ done: if (dict) { dict_del (dict, GFID_XATTR_KEY); + dict_del (dict, GF_XATTR_VOL_ID_KEY); dict_ref (dict); } @@ -3908,6 +3911,7 @@ posix_fsetxattr (call_frame_t *frame, xlator_t *this, _fd = pfd->fd; dict_del (dict, GFID_XATTR_KEY); + dict_del (dict, GF_XATTR_VOL_ID_KEY); filler.fd = _fd; filler.this = this; @@ -3967,6 +3971,12 @@ posix_removexattr (call_frame_t *frame, xlator_t *this, op_ret = -1; goto out; } + if (!strcmp (GF_XATTR_VOL_ID_KEY, name)) { + gf_log (this->name, GF_LOG_WARNING, "Remove xattr called" + " on volume-id for file %s", real_path); + op_ret = -1; + goto out; + } SET_FS_ID (frame->root->uid, frame->root->gid); @@ -4023,6 +4033,11 @@ posix_fremovexattr (call_frame_t *frame, xlator_t *this, " on gfid for file"); goto out; } + if (!strcmp (GF_XATTR_VOL_ID_KEY, name)) { + gf_log (this->name, GF_LOG_WARNING, "Remove xattr called" + " on volume-id for file"); + goto out; + } ret = posix_fd_ctx_get (fd, this, &pfd); if (ret < 0) { -- cgit