From 96eece8abbb9c06f0b91f37e718ac9e337a3f714 Mon Sep 17 00:00:00 2001 From: Kotresh HR Date: Mon, 10 Jul 2017 10:31:27 -0400 Subject: 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 Reviewed-on: https://review.gluster.org/17744 Smoke: Gluster Build System Reviewed-by: Prashanth Pai Reviewed-by: Raghavendra Bhat Reviewed-by: Aravinda VK CentOS-regression: Gluster Build System --- tests/gfid2path/block-mount-access.t | 54 ++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 tests/gfid2path/block-mount-access.t (limited to 'tests/gfid2path/block-mount-access.t') diff --git a/tests/gfid2path/block-mount-access.t b/tests/gfid2path/block-mount-access.t new file mode 100644 index 00000000000..2130927504a --- /dev/null +++ b/tests/gfid2path/block-mount-access.t @@ -0,0 +1,54 @@ +#!/bin/bash + +. $(dirname $0)/../include.rc +. $(dirname $0)/../volume.rc +. $(dirname $0)/../afr.rc + +cleanup; + +TEST glusterd +TEST pidof glusterd + +## Create a 2*2 volume +TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{0,1} +EXPECT "$V0" volinfo_field $V0 'Volume Name'; +EXPECT 'Created' volinfo_field $V0 'Status'; + +## Start the volume +TEST $CLI volume start $V0 +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "Y" glustershd_up_status +EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status_in_shd $V0 0 +EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status_in_shd $V0 1 +TEST $GFS --volfile-id=$V0 --volfile-server=$H0 $M0; + +## enable gfid2path +TEST $CLI volume set $V0 gfid2path enable + +## Mount the volume +TEST $GFS --volfile-server=$H0 --volfile-id=$V0 $M0; + +#CREATE +fname=$M0/file1 +touch $fname; +backpath=$B0/${V0}1/file1 + +pgfid="00000000-0000-0000-0000-000000000001" + +#Check for the presence of xattr +key="trusted.gfid2path" +gfid2path_xattr=$(getfattr -h -d -m. $backpath 2>/dev/null | grep -a $key | cut -f1 -d'=') + +#Check getxattr +TEST ! getfattr -h -n $gfid2path_xattr $M0/file1 + +#Check listgetxattr +EXPECT_NOT $gfid2path_xattr get_xattr_key $key $M0/file1 + +#Check removexattr +TEST ! setfattr -h -x $gfid2path_xattr $M0/file1 + +#Check setxattr +TEST ! setfattr -h -n "trusted.gfid2path.d16e15bafe6e4257" -v "$pgfid/file2" $M0/file1 + +#Cleanup +cleanup; -- cgit