2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016 Red Hat. All Rights Reserved.
7 # Check if SGID is cleared upon chmod / setfacl when the owner is not in the
11 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
16 status=1 # failure is the default!
17 trap "_cleanup; exit \$status" 0 1 2 3 15
25 # get standard environment, filters and checks
30 # real QA test starts here
39 # try with both regular file and directory
40 for filetype in regular dir; do
44 testfile=testfile.$seq
55 chown 100:100 $testfile
57 echo '*** SGID should remain set (twice)'
59 _runas -u 100 -g 100 -- chmod 2777 $testfile
62 _runas -u 100 -g 100 -- setfacl -m u::rwx,g::rwx,o::rwx $testfile
65 echo '*** SGID should be cleared (twice)'
67 _runas -u 100 -g 101 -- chmod 2777 $testfile
70 _runas -u 100 -g 101 -- setfacl -m u::rwx,g::rwx,o::rwx $testfile
73 echo '*** Expected failure'
74 _runas -u 101 -g 101 -- chmod 2777 $testfile