From: Nathaniel Clark Date: Wed, 5 Mar 2014 17:36:52 +0000 (-0500) Subject: LU-4703 tests: Add test to check setxattr fails when it should X-Git-Tag: 2.5.57~12 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=642b095568a9bc6aec68a85d9e46dbe1b8c7d1c0;ds=sidebyside LU-4703 tests: Add test to check setxattr fails when it should Setxattr was not correctly checking permissions in all cases. This adds a test to sanity to ensure that trying to set xattrs on a file fails when it should. Signed-off-by: Nathaniel Clark Change-Id: Id95e13ec3bcbedb7cbb069c610d506d1f3d899a8 Reviewed-on: http://review.whamcloud.com/9508 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Bob Glossman Reviewed-by: John L. Hammond Reviewed-by: Andreas Dilger --- diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 84b18e0..a1c5f65 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -6549,6 +6549,25 @@ test_102n() { # LU-4101 mdt: protect internal xattrs } run_test 102n "silently ignore setxattr on internal trusted xattrs" +test_102p() { # LU-4703 setxattr did not check ownership + local testfile=$DIR/$tfile + + [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.5.56) ] && + skip "MDS needs to be at least 2.5.56" && return + + touch $testfile + + echo "setfacl as user..." + $RUNAS setfacl -m "u:$RUNAS_ID:rwx" $testfile + [ $? -ne 0 ] || error "setfacl by $RUNAS_ID was allowed on $testfile" + + echo "setfattr as user..." + setfacl -m "u:$RUNAS_ID:---" $testfile + $RUNAS setfattr -x system.posix_acl_access $testfile + [ $? -ne 0 ] || error "setfattr by $RUNAS_ID was allowed on $testfile" +} +run_test 102p "check setxattr(2) correctly fails without permission" + run_acl_subtest() { $LUSTRE/tests/acl/run $LUSTRE/tests/acl/$1.test