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
36 testfile=$TEST_DIR/$seq.test
41 su $qa_user -c "$XFS_IO_PROG -d -c 'pwrite 0 4k' $testfile" \
45 echo "Check that suid/sgid bits are cleared after direct write"
47 # create testfile and set base ownership & permission
48 echo "this is a test" >> $testfile
50 chown $qa_user:$qa_user $testfile
52 echo "== with no exec perm"
54 echo -n "before: "; stat -c '%A' $testfile
56 echo -n "after: "; stat -c '%A' $testfile
58 echo "== with user exec perm"
61 echo -n "before: "; stat -c '%A' $testfile
63 echo -n "after: "; stat -c '%A' $testfile
65 echo "== with group exec perm"
69 echo -n "before: "; stat -c '%A' $testfile
71 echo -n "after: "; stat -c '%A' $testfile
73 echo "== with user+group exec perm"
76 echo -n "before: "; stat -c '%A' $testfile
78 echo -n "after: "; stat -c '%A' $testfile