echo
}
-# Commit to a non-exec file by an unprivileged user clears suid but leaves
-# sgid.
+# Commit to a non-exec file by an unprivileged user clears suid and sgid
echo "Test 1 - qa_user, non-exec file"
setup_testfile
chmod a+rws $SCRATCH_MNT/a
chmod g+x,a+rws $SCRATCH_MNT/a
commit_and_check "$qa_user"
-# Commit to a user-exec file by an unprivileged user clears suid but not sgid.
+# Commit to a user-exec file by an unprivileged user clears suid and sgid.
echo "Test 3 - qa_user, user-exec file"
setup_testfile
chmod u+x,a+rws,g-x $SCRATCH_MNT/a
chmod a+rwxs $SCRATCH_MNT/a
commit_and_check "$qa_user"
-# Commit to a non-exec file by root clears suid but leaves sgid.
+# Commit to a non-exec file by root leaves suid and sgid.
echo "Test 5 - root, non-exec file"
setup_testfile
chmod a+rws $SCRATCH_MNT/a
commit_and_check
-# Commit to a group-exec file by root clears suid and sgid.
+# Commit to a group-exec file by root leaves suid and sgid.
echo "Test 6 - root, group-exec file"
setup_testfile
chmod g+x,a+rws $SCRATCH_MNT/a
commit_and_check
-# Commit to a user-exec file by root clears suid but not sgid.
+# Commit to a user-exec file by root leaves suid and sgid.
echo "Test 7 - root, user-exec file"
setup_testfile
chmod u+x,a+rws,g-x $SCRATCH_MNT/a
commit_and_check
-# Commit to a all-exec file by root clears suid and sgid.
+# Commit to a all-exec file by root leaves suid and sgid.
echo "Test 8 - root, all-exec file"
setup_testfile
chmod a+rwxs $SCRATCH_MNT/a
commit_and_check
+#Commit to a non-exec file by an unprivileged user leaves sgid.
+echo "Test 9 - qa_user, non-exec file, only sgid"
+setup_testfile
+chmod a+rw,g+rws $SCRATCH_MNT/a
+commit_and_check "$qa_user"
+
+#Commit to a group-exec file by an unprivileged user clears sgid
+echo "Test 10 - qa_user, group-exec file, only sgid"
+setup_testfile
+chmod a+rw,g+rwxs $SCRATCH_MNT/a
+commit_and_check "$qa_user"
+
+#Commit to a user-exec file by an unprivileged user clears sgid
+echo "Test 11 - qa_user, user-exec file, only sgid"
+setup_testfile
+chmod a+rw,u+x,g+rws $SCRATCH_MNT/a
+commit_and_check "$qa_user"
+
+#Commit to a all-exec file by an unprivileged user clears sgid.
+echo "Test 12 - qa_user, all-exec file, only sgid"
+setup_testfile
+chmod a+rwx,g+rwxs $SCRATCH_MNT/a
+commit_and_check "$qa_user"
+
# success, all done
status=0
exit
3784de23efab7a2074c9ec66901e39e5 SCRATCH_MNT/a
6777 -rwsrwsrwx SCRATCH_MNT/a
+Test 9 - qa_user, non-exec file, only sgid
+310f146ce52077fcd3308dcbe7632bb2 SCRATCH_MNT/a
+2666 -rw-rwSrw- SCRATCH_MNT/a
+3784de23efab7a2074c9ec66901e39e5 SCRATCH_MNT/a
+2666 -rw-rwSrw- SCRATCH_MNT/a
+
+Test 10 - qa_user, group-exec file, only sgid
+310f146ce52077fcd3308dcbe7632bb2 SCRATCH_MNT/a
+2676 -rw-rwsrw- SCRATCH_MNT/a
+3784de23efab7a2074c9ec66901e39e5 SCRATCH_MNT/a
+676 -rw-rwxrw- SCRATCH_MNT/a
+
+Test 11 - qa_user, user-exec file, only sgid
+310f146ce52077fcd3308dcbe7632bb2 SCRATCH_MNT/a
+2766 -rwxrwSrw- SCRATCH_MNT/a
+3784de23efab7a2074c9ec66901e39e5 SCRATCH_MNT/a
+2766 -rwxrwSrw- SCRATCH_MNT/a
+
+Test 12 - qa_user, all-exec file, only sgid
+310f146ce52077fcd3308dcbe7632bb2 SCRATCH_MNT/a
+2777 -rwxrwsrwx SCRATCH_MNT/a
+3784de23efab7a2074c9ec66901e39e5 SCRATCH_MNT/a
+777 -rwxrwxrwx SCRATCH_MNT/a
+