xfs: add a new test for removing ACLs through the attr interface
authorChristoph Hellwig <hch@lst.de>
Tue, 7 Jan 2020 16:52:55 +0000 (17:52 +0100)
committerEryu Guan <guaneryu@gmail.com>
Sun, 2 Feb 2020 12:46:58 +0000 (20:46 +0800)
Test that removing the SGI_ACL_FILE attr also removes the cached ACL
used for access control checking.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
tests/xfs/512 [new file with mode: 0755]
tests/xfs/512.out [new file with mode: 0644]
tests/xfs/group

diff --git a/tests/xfs/512 b/tests/xfs/512
new file mode 100755 (executable)
index 0000000..3d2fa72
--- /dev/null
@@ -0,0 +1,59 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2020 Christoph Hellwig
+#
+# FS QA Test 512
+#
+# Ensure that removing the access ACL through the XFS-specific attr name removes
+# the cached ACL as well
+#
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1       # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+       cd /
+       rm -f $FILE
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/attr
+
+# real QA test starts here
+_supported_fs xfs
+_supported_os Linux
+
+_require_test
+_require_runas
+_require_acls
+_require_attrs
+_require_user
+
+FILE=$TEST_DIR/foo
+
+echo "This is a test" > ${FILE}
+chmod g-r $FILE
+chmod o-r $FILE
+chmod u-r $FILE
+
+echo "No ACL: "
+_user_do "cat $FILE"
+
+echo "With ACL: "
+setfacl -m u:$qa_user:r $FILE
+_user_do "cat $FILE"
+
+echo "ACL Removed through attr:"
+$SETFATTR_PROG -x trusted.SGI_ACL_FILE ${FILE}
+_user_do "cat $FILE"
+
+status=0
+exit
diff --git a/tests/xfs/512.out b/tests/xfs/512.out
new file mode 100644 (file)
index 0000000..760346a
--- /dev/null
@@ -0,0 +1,7 @@
+QA output created by 512
+No ACL: 
+Permission denied
+With ACL: 
+This is a test
+ACL Removed through attr:
+Permission denied
index c7253cf10788351a4e4f0d8260ae4c05592b4ca1..45dd8868c3112e76fded56d480e9ceadb840fdd0 100644 (file)
 509 auto ioctl
 510 auto ioctl quick
 511 auto quick quota
+512 auto quick acl attr