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
38 # try with both regular file and directory
39 for filetype in regular dir; do
43 testfile=testfile.$seq
54 chown 100:100 $testfile
56 echo '*** SGID should remain set (twice)'
58 _runas -u 100 -g 100 -- chmod 2777 $testfile
61 _runas -u 100 -g 100 -- setfacl -m u::rwx,g::rwx,o::rwx $testfile
64 echo '*** SGID should be cleared (twice)'
66 _runas -u 100 -g 101 -- chmod 2777 $testfile
69 _runas -u 100 -g 101 -- setfacl -m u::rwx,g::rwx,o::rwx $testfile
72 echo '*** Expected failure'
73 _runas -u 101 -g 101 -- chmod 2777 $testfile