2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016 Red Hat Inc., All Rights Reserved.
7 # Test clear of suid/sgid on direct write.
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
15 status=1 # failure is the default!
16 trap "_cleanup; exit \$status" 0 1 2 3 15
24 # get standard environment, filters and checks
30 # real QA test starts here
37 testfile=$TEST_DIR/$seq.test
42 su $qa_user -c "$XFS_IO_PROG -d -c 'pwrite 0 4k' $testfile" \
46 echo "Check that suid/sgid bits are cleared after direct write"
48 # create testfile and set base ownership & permission
49 echo "this is a test" >> $testfile
51 chown $qa_user:$qa_user $testfile
53 echo "== with no exec perm"
55 echo -n "before: "; stat -c '%A' $testfile
57 echo -n "after: "; stat -c '%A' $testfile
59 echo "== with user exec perm"
62 echo -n "before: "; stat -c '%A' $testfile
64 echo -n "after: "; stat -c '%A' $testfile
66 echo "== with group exec perm"
70 echo -n "before: "; stat -c '%A' $testfile
72 echo -n "after: "; stat -c '%A' $testfile
74 echo "== with user+group exec perm"
77 echo -n "before: "; stat -c '%A' $testfile
79 echo -n "after: "; stat -c '%A' $testfile