]> www.infradead.org Git - users/hch/xfstests-dev.git/commitdiff
generic/68[3-7]: Add separate sgid stripping sub-tests
authorYang Xu <xuyang2018.jy@fujitsu.com>
Tue, 10 May 2022 05:24:50 +0000 (13:24 +0800)
committerZorro Lang <zlang@kernel.org>
Wed, 11 May 2022 06:12:25 +0000 (14:12 +0800)
Like xfstests commit 298f60c ("generic/673: Add separate sgid stripping sub-tests"),
we should also add separate sgid stripping sub-tests for each fallocate operation.

Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
tests/generic/683
tests/generic/683.out
tests/generic/684
tests/generic/684.out
tests/generic/685
tests/generic/685.out
tests/generic/686
tests/generic/686.out
tests/generic/687
tests/generic/687.out

index c512989b9c656c37cadc6d7f635a1f725348916a..746ead86f4f415256a3ffc1f25a47d0793c58f96 100755 (executable)
@@ -61,67 +61,78 @@ commit_and_check() {
        echo
 }
 
-nr=0
-# Commit to a non-exec file by an unprivileged user clears suid but
-# leaves sgid.
-nr=$((nr + 1))
-echo "Test $nr - qa_user, non-exec file $verb"
+# Commit to a non-exec file by an unprivileged user clears suid and sgid.
+echo "Test 1 - qa_user, non-exec file $verb"
 setup_testfile
 chmod a+rws $junk_file
 commit_and_check "$qa_user" "$verb" 64k 64k
 
-# Commit to a group-exec file by an unprivileged user clears suid and
-# sgid.
-nr=$((nr + 1))
-echo "Test $nr - qa_user, group-exec file $verb"
+# Commit to a group-exec file by an unprivileged user clears suid and sgid.
+echo "Test 2 - qa_user, group-exec file $verb"
 setup_testfile
 chmod g+x,a+rws $junk_file
 commit_and_check "$qa_user" "$verb" 64k 64k
 
-# Commit to a user-exec file by an unprivileged user clears suid but
-# not sgid.
-nr=$((nr + 1))
-echo "Test $nr - qa_user, user-exec file $verb"
+# Commit to a user-exec file by an unprivileged user clears suid and sgid.
+echo "Test 3 - qa_user, user-exec file $verb"
 setup_testfile
 chmod u+x,a+rws,g-x $junk_file
 commit_and_check "$qa_user" "$verb" 64k 64k
 
-# Commit to a all-exec file by an unprivileged user clears suid and
-# sgid.
-nr=$((nr + 1))
-echo "Test $nr - qa_user, all-exec file $verb"
+# Commit to a all-exec file by an unprivileged user clears suid and sgid.
+echo "Test 4 - qa_user, all-exec file $verb"
 setup_testfile
 chmod a+rwxs $junk_file
 commit_and_check "$qa_user" "$verb" 64k 64k
 
-# Commit to a non-exec file by root clears suid but leaves sgid.
-nr=$((nr + 1))
-echo "Test $nr - root, non-exec file $verb"
+# Commit to a non-exec file by root leaves suid and sgid.
+echo "Test 5 - root, non-exec file $verb"
 setup_testfile
 chmod a+rws $junk_file
 commit_and_check "" "$verb" 64k 64k
 
-# Commit to a group-exec file by root clears suid and sgid.
-nr=$((nr + 1))
-echo "Test $nr - root, group-exec file $verb"
+# Commit to a group-exec file by root leaves suid and sgid.
+echo "Test 6 - root, group-exec file $verb"
 setup_testfile
 chmod g+x,a+rws $junk_file
 commit_and_check "" "$verb" 64k 64k
 
-# Commit to a user-exec file by root clears suid but not sgid.
-nr=$((nr + 1))
-echo "Test $nr - root, user-exec file $verb"
+# Commit to a user-exec file by root leaves suid and sgid.
+echo "Test 7 - root, user-exec file $verb"
 setup_testfile
 chmod u+x,a+rws,g-x $junk_file
 commit_and_check "" "$verb" 64k 64k
 
-# Commit to a all-exec file by root clears suid and sgid.
-nr=$((nr + 1))
-echo "Test $nr - root, all-exec file $verb"
+# Commit to a all-exec file by root leaves suid and sgid.
+echo "Test 8 - root, all-exec file $verb"
 setup_testfile
 chmod a+rwxs $junk_file
 commit_and_check "" "$verb" 64k 64k
 
+# Commit to a non-exec file by an unprivileged user leaves sgid.
+echo "Test 9 - qa_user, non-exec file $verb, only sgid"
+setup_testfile
+chmod a+rw,g+rws $junk_file
+commit_and_check "$qa_user" "$verb" 64k 64k
+
+# Commit to a group-exec file by an unprivileged user clears sgid
+echo "Test 10 - qa_user, group-exec file $verb, only sgid"
+setup_testfile
+chmod a+rw,g+rwxs $junk_file
+commit_and_check "$qa_user" "$verb" 64k 64k
+
+# Commit to a user-exec file by an unprivileged user clears sgid
+echo "Test 11 - qa_user, user-exec file $verb, only sgid"
+setup_testfile
+chmod a+rw,u+x,g+rws $junk_file
+commit_and_check "$qa_user" "$verb" 64k 64k
+
+# Commit to a all-exec file by an unprivileged user clears sgid.
+echo "Test 12 - qa_user, all-exec file $verb, only sgid"
+setup_testfile
+chmod a+rwx,g+rwxs $junk_file
+commit_and_check "$qa_user" "$verb" 64k 64k
+
 # success, all done
 status=0
 exit
index 9d1c9f80feb420f43415287996c84c1dc86d0d9c..ca29f6e6760e67db735170355d0039bf42413b0d 100644 (file)
@@ -31,3 +31,19 @@ Test 8 - root, all-exec file falloc
 6777 -rwsrwsrwx TEST_DIR/683/a
 6777 -rwsrwsrwx TEST_DIR/683/a
 
+Test 9 - qa_user, non-exec file falloc, only sgid
+2666 -rw-rwSrw- TEST_DIR/683/a
+2666 -rw-rwSrw- TEST_DIR/683/a
+
+Test 10 - qa_user, group-exec file falloc, only sgid
+2676 -rw-rwsrw- TEST_DIR/683/a
+676 -rw-rwxrw- TEST_DIR/683/a
+
+Test 11 - qa_user, user-exec file falloc, only sgid
+2766 -rwxrwSrw- TEST_DIR/683/a
+2766 -rwxrwSrw- TEST_DIR/683/a
+
+Test 12 - qa_user, all-exec file falloc, only sgid
+2777 -rwxrwsrwx TEST_DIR/683/a
+777 -rwxrwxrwx TEST_DIR/683/a
+
index d59f4239d81fdfcb388521433cf358aec89315d2..4bebeff0399b4bc3558ea08e73fda2bd8c22322e 100755 (executable)
@@ -61,67 +61,78 @@ commit_and_check() {
        echo
 }
 
-nr=0
-# Commit to a non-exec file by an unprivileged user clears suid but
-# leaves sgid.
-nr=$((nr + 1))
-echo "Test $nr - qa_user, non-exec file $verb"
+# Commit to a non-exec file by an unprivileged user clears suid and sgid.
+echo "Test 1 - qa_user, non-exec file $verb"
 setup_testfile
 chmod a+rws $junk_file
 commit_and_check "$qa_user" "$verb" 64k 64k
 
-# Commit to a group-exec file by an unprivileged user clears suid and
-# sgid.
-nr=$((nr + 1))
-echo "Test $nr - qa_user, group-exec file $verb"
+# Commit to a group-exec file by an unprivileged user clears suid and sgid.
+echo "Test 2 - qa_user, group-exec file $verb"
 setup_testfile
 chmod g+x,a+rws $junk_file
 commit_and_check "$qa_user" "$verb" 64k 64k
 
-# Commit to a user-exec file by an unprivileged user clears suid but
-# not sgid.
-nr=$((nr + 1))
-echo "Test $nr - qa_user, user-exec file $verb"
+# Commit to a user-exec file by an unprivileged user clears suid and sgid.
+echo "Test 3 - qa_user, user-exec file $verb"
 setup_testfile
 chmod u+x,a+rws,g-x $junk_file
 commit_and_check "$qa_user" "$verb" 64k 64k
 
-# Commit to a all-exec file by an unprivileged user clears suid and
-# sgid.
-nr=$((nr + 1))
-echo "Test $nr - qa_user, all-exec file $verb"
+# Commit to a all-exec file by an unprivileged user clears suid and sgid.
+echo "Test 4 - qa_user, all-exec file $verb"
 setup_testfile
 chmod a+rwxs $junk_file
 commit_and_check "$qa_user" "$verb" 64k 64k
 
-# Commit to a non-exec file by root clears suid but leaves sgid.
-nr=$((nr + 1))
-echo "Test $nr - root, non-exec file $verb"
+# Commit to a non-exec file by root leaves suid and sgid.
+echo "Test 5 - root, non-exec file $verb"
 setup_testfile
 chmod a+rws $junk_file
 commit_and_check "" "$verb" 64k 64k
 
-# Commit to a group-exec file by root clears suid and sgid.
-nr=$((nr + 1))
-echo "Test $nr - root, group-exec file $verb"
+# Commit to a group-exec file by root leaves suid and sgid.
+echo "Test 6 - root, group-exec file $verb"
 setup_testfile
 chmod g+x,a+rws $junk_file
 commit_and_check "" "$verb" 64k 64k
 
-# Commit to a user-exec file by root clears suid but not sgid.
-nr=$((nr + 1))
-echo "Test $nr - root, user-exec file $verb"
+# Commit to a user-exec file by root leaves suid and sgid.
+echo "Test 7 - root, user-exec file $verb"
 setup_testfile
 chmod u+x,a+rws,g-x $junk_file
 commit_and_check "" "$verb" 64k 64k
 
-# Commit to a all-exec file by root clears suid and sgid.
-nr=$((nr + 1))
-echo "Test $nr - root, all-exec file $verb"
+# Commit to a all-exec file by root leaves suid and sgid.
+echo "Test 8 - root, all-exec file $verb"
 setup_testfile
 chmod a+rwxs $junk_file
 commit_and_check "" "$verb" 64k 64k
 
+# Commit to a non-exec file by an unprivileged user leaves sgid.
+echo "Test 9 - qa_user, non-exec file $verb, only sgid"
+setup_testfile
+chmod a+rw,g+rws $junk_file
+commit_and_check "$qa_user" "$verb" 64k 64k
+
+# Commit to a group-exec file by an unprivileged user clears sgid
+echo "Test 10 - qa_user, group-exec file $verb, only sgid"
+setup_testfile
+chmod a+rw,g+rwxs $junk_file
+commit_and_check "$qa_user" "$verb" 64k 64k
+
+# Commit to a user-exec file by an unprivileged user clears sgid
+echo "Test 11 - qa_user, user-exec file $verb, only sgid"
+setup_testfile
+chmod a+rw,u+x,g+rws $junk_file
+commit_and_check "$qa_user" "$verb" 64k 64k
+
+# Commit to a all-exec file by an unprivileged user clears sgid.
+echo "Test 12 - qa_user, all-exec file $verb, only sgid"
+setup_testfile
+chmod a+rwx,g+rwxs $junk_file
+commit_and_check "$qa_user" "$verb" 64k 64k
+
 # success, all done
 status=0
 exit
index df5b37889ef2a083c92ac02a7c604e50ef8ac42d..2e084ceda4f191a12b533ad4d0732a20ba014b51 100644 (file)
@@ -31,3 +31,19 @@ Test 8 - root, all-exec file fpunch
 6777 -rwsrwsrwx TEST_DIR/684/a
 6777 -rwsrwsrwx TEST_DIR/684/a
 
+Test 9 - qa_user, non-exec file fpunch, only sgid
+2666 -rw-rwSrw- TEST_DIR/684/a
+2666 -rw-rwSrw- TEST_DIR/684/a
+
+Test 10 - qa_user, group-exec file fpunch, only sgid
+2676 -rw-rwsrw- TEST_DIR/684/a
+676 -rw-rwxrw- TEST_DIR/684/a
+
+Test 11 - qa_user, user-exec file fpunch, only sgid
+2766 -rwxrwSrw- TEST_DIR/684/a
+2766 -rwxrwSrw- TEST_DIR/684/a
+
+Test 12 - qa_user, all-exec file fpunch, only sgid
+2777 -rwxrwsrwx TEST_DIR/684/a
+777 -rwxrwxrwx TEST_DIR/684/a
+
index 2e990465c3a9525e7cc782f37e3d896cf0577887..03447e0031f3d87ec400cfa8769a3d3625796042 100755 (executable)
@@ -61,67 +61,78 @@ commit_and_check() {
        echo
 }
 
-nr=0
-# Commit to a non-exec file by an unprivileged user clears suid but
-# leaves sgid.
-nr=$((nr + 1))
-echo "Test $nr - qa_user, non-exec file $verb"
+# Commit to a non-exec file by an unprivileged user clears suid and sgid.
+echo "Test 1 - qa_user, non-exec file $verb"
 setup_testfile
 chmod a+rws $junk_file
 commit_and_check "$qa_user" "$verb" 64k 64k
 
-# Commit to a group-exec file by an unprivileged user clears suid and
-# sgid.
-nr=$((nr + 1))
-echo "Test $nr - qa_user, group-exec file $verb"
+# Commit to a group-exec file by an unprivileged user clears suid and sgid.
+echo "Test 2 - qa_user, group-exec file $verb"
 setup_testfile
 chmod g+x,a+rws $junk_file
 commit_and_check "$qa_user" "$verb" 64k 64k
 
-# Commit to a user-exec file by an unprivileged user clears suid but
-# not sgid.
-nr=$((nr + 1))
-echo "Test $nr - qa_user, user-exec file $verb"
+# Commit to a user-exec file by an unprivileged user clears suid and sgid.
+echo "Test 3 - qa_user, user-exec file $verb"
 setup_testfile
 chmod u+x,a+rws,g-x $junk_file
 commit_and_check "$qa_user" "$verb" 64k 64k
 
-# Commit to a all-exec file by an unprivileged user clears suid and
-# sgid.
-nr=$((nr + 1))
-echo "Test $nr - qa_user, all-exec file $verb"
+# Commit to a all-exec file by an unprivileged user clears suid and sgid.
+echo "Test 4 - qa_user, all-exec file $verb"
 setup_testfile
 chmod a+rwxs $junk_file
 commit_and_check "$qa_user" "$verb" 64k 64k
 
-# Commit to a non-exec file by root clears suid but leaves sgid.
-nr=$((nr + 1))
-echo "Test $nr - root, non-exec file $verb"
+# Commit to a non-exec file by root leaves suid and sgid.
+echo "Test 5 - root, non-exec file $verb"
 setup_testfile
 chmod a+rws $junk_file
 commit_and_check "" "$verb" 64k 64k
 
-# Commit to a group-exec file by root clears suid and sgid.
-nr=$((nr + 1))
-echo "Test $nr - root, group-exec file $verb"
+# Commit to a group-exec file by root leaves suid and sgid.
+echo "Test 6 - root, group-exec file $verb"
 setup_testfile
 chmod g+x,a+rws $junk_file
 commit_and_check "" "$verb" 64k 64k
 
-# Commit to a user-exec file by root clears suid but not sgid.
-nr=$((nr + 1))
-echo "Test $nr - root, user-exec file $verb"
+# Commit to a user-exec file by root leaves suid and sgid.
+echo "Test 7 - root, user-exec file $verb"
 setup_testfile
 chmod u+x,a+rws,g-x $junk_file
 commit_and_check "" "$verb" 64k 64k
 
-# Commit to a all-exec file by root clears suid and sgid.
-nr=$((nr + 1))
-echo "Test $nr - root, all-exec file $verb"
+# Commit to a all-exec file by root leaves suid and sgid.
+echo "Test 8 - root, all-exec file $verb"
 setup_testfile
 chmod a+rwxs $junk_file
 commit_and_check "" "$verb" 64k 64k
 
+# Commit to a non-exec file by an unprivileged user leaves sgid.
+echo "Test 9 - qa_user, non-exec file $verb, only sgid"
+setup_testfile
+chmod a+rw,g+rws $junk_file
+commit_and_check "$qa_user" "$verb" 64k 64k
+
+# Commit to a group-exec file by an unprivileged user clears sgid
+echo "Test 10 - qa_user, group-exec file $verb, only sgid"
+setup_testfile
+chmod a+rw,g+rwxs $junk_file
+commit_and_check "$qa_user" "$verb" 64k 64k
+
+# Commit to a user-exec file by an unprivileged user clears sgid
+echo "Test 11 - qa_user, user-exec file $verb, only sgid"
+setup_testfile
+chmod a+rw,u+x,g+rws $junk_file
+commit_and_check "$qa_user" "$verb" 64k 64k
+
+# Commit to a all-exec file by an unprivileged user clears sgid.
+echo "Test 12 - qa_user, all-exec file $verb, only sgid"
+setup_testfile
+chmod a+rwx,g+rwxs $junk_file
+commit_and_check "$qa_user" "$verb" 64k 64k
+
 # success, all done
 status=0
 exit
index 90b7a0de5d8e84238c80ccd109f64cbd67ddf084..e611da3e9c8580146a455aff5167af8b75e2c369 100644 (file)
@@ -31,3 +31,19 @@ Test 8 - root, all-exec file fzero
 6777 -rwsrwsrwx TEST_DIR/685/a
 6777 -rwsrwsrwx TEST_DIR/685/a
 
+Test 9 - qa_user, non-exec file fzero, only sgid
+2666 -rw-rwSrw- TEST_DIR/685/a
+2666 -rw-rwSrw- TEST_DIR/685/a
+
+Test 10 - qa_user, group-exec file fzero, only sgid
+2676 -rw-rwsrw- TEST_DIR/685/a
+676 -rw-rwxrw- TEST_DIR/685/a
+
+Test 11 - qa_user, user-exec file fzero, only sgid
+2766 -rwxrwSrw- TEST_DIR/685/a
+2766 -rwxrwSrw- TEST_DIR/685/a
+
+Test 12 - qa_user, all-exec file fzero, only sgid
+2777 -rwxrwsrwx TEST_DIR/685/a
+777 -rwxrwxrwx TEST_DIR/685/a
+
index 71c3aebb351909e8c8e531d07838ea2613841723..eae3cbda5fb5308834fd43ae1267a61620c9c886 100755 (executable)
@@ -61,67 +61,78 @@ commit_and_check() {
        echo
 }
 
-nr=0
-# Commit to a non-exec file by an unprivileged user clears suid but
-# leaves sgid.
-nr=$((nr + 1))
-echo "Test $nr - qa_user, non-exec file $verb"
+# Commit to a non-exec file by an unprivileged user clears suid and sgid.
+echo "Test 1 - qa_user, non-exec file $verb"
 setup_testfile
 chmod a+rws $junk_file
 commit_and_check "$qa_user" "$verb" 64k 64k
 
-# Commit to a group-exec file by an unprivileged user clears suid and
-# sgid.
-nr=$((nr + 1))
-echo "Test $nr - qa_user, group-exec file $verb"
+# Commit to a group-exec file by an unprivileged user clears suid and sgid.
+echo "Test 2 - qa_user, group-exec file $verb"
 setup_testfile
 chmod g+x,a+rws $junk_file
 commit_and_check "$qa_user" "$verb" 64k 64k
 
-# Commit to a user-exec file by an unprivileged user clears suid but
-# not sgid.
-nr=$((nr + 1))
-echo "Test $nr - qa_user, user-exec file $verb"
+# Commit to a user-exec file by an unprivileged user clears suid and sgid.
+echo "Test 3 - qa_user, user-exec file $verb"
 setup_testfile
 chmod u+x,a+rws,g-x $junk_file
 commit_and_check "$qa_user" "$verb" 64k 64k
 
-# Commit to a all-exec file by an unprivileged user clears suid and
-# sgid.
-nr=$((nr + 1))
-echo "Test $nr - qa_user, all-exec file $verb"
+# Commit to a all-exec file by an unprivileged user clears suid and sgid.
+echo "Test 4 - qa_user, all-exec file $verb"
 setup_testfile
 chmod a+rwxs $junk_file
 commit_and_check "$qa_user" "$verb" 64k 64k
 
-# Commit to a non-exec file by root clears suid but leaves sgid.
-nr=$((nr + 1))
-echo "Test $nr - root, non-exec file $verb"
+# Commit to a non-exec file by root leaves suid and sgid.
+echo "Test 5 - root, non-exec file $verb"
 setup_testfile
 chmod a+rws $junk_file
 commit_and_check "" "$verb" 64k 64k
 
-# Commit to a group-exec file by root clears suid and sgid.
-nr=$((nr + 1))
-echo "Test $nr - root, group-exec file $verb"
+# Commit to a group-exec file by root leaves suid and sgid.
+echo "Test 6 - root, group-exec file $verb"
 setup_testfile
 chmod g+x,a+rws $junk_file
 commit_and_check "" "$verb" 64k 64k
 
-# Commit to a user-exec file by root clears suid but not sgid.
-nr=$((nr + 1))
-echo "Test $nr - root, user-exec file $verb"
+# Commit to a user-exec file by root leaves suid and sgid.
+echo "Test 7 - root, user-exec file $verb"
 setup_testfile
 chmod u+x,a+rws,g-x $junk_file
 commit_and_check "" "$verb" 64k 64k
 
-# Commit to a all-exec file by root clears suid and sgid.
-nr=$((nr + 1))
-echo "Test $nr - root, all-exec file $verb"
+# Commit to a all-exec file by root leaves suid and sgid.
+echo "Test 8 - root, all-exec file $verb"
 setup_testfile
 chmod a+rwxs $junk_file
 commit_and_check "" "$verb" 64k 64k
 
+# Commit to a non-exec file by an unprivileged user leaves sgid.
+echo "Test 9 - qa_user, non-exec file $verb, only sgid"
+setup_testfile
+chmod a+rw,g+rws $junk_file
+commit_and_check "$qa_user" "$verb" 64k 64k
+
+# Commit to a group-exec file by an unprivileged user clears sgid
+echo "Test 10 - qa_user, group-exec file $verb, only sgid"
+setup_testfile
+chmod a+rw,g+rwxs $junk_file
+commit_and_check "$qa_user" "$verb" 64k 64k
+
+# Commit to a user-exec file by an unprivileged user clears sgid
+echo "Test 11 - qa_user, user-exec file $verb, only sgid"
+setup_testfile
+chmod a+rw,u+x,g+rws $junk_file
+commit_and_check "$qa_user" "$verb" 64k 64k
+
+# Commit to a all-exec file by an unprivileged user clears sgid.
+echo "Test 12 - qa_user, all-exec file $verb, only sgid"
+setup_testfile
+chmod a+rwx,g+rwxs $junk_file
+commit_and_check "$qa_user" "$verb" 64k 64k
+
 # success, all done
 status=0
 exit
index 6a1179f1ed78a360665f04ec2ea3c8b91e67b34b..aa1e64715dde715c98e03e5035ad1d8116025911 100644 (file)
@@ -31,3 +31,19 @@ Test 8 - root, all-exec file finsert
 6777 -rwsrwsrwx TEST_DIR/686/a
 6777 -rwsrwsrwx TEST_DIR/686/a
 
+Test 9 - qa_user, non-exec file finsert, only sgid
+2666 -rw-rwSrw- TEST_DIR/686/a
+2666 -rw-rwSrw- TEST_DIR/686/a
+
+Test 10 - qa_user, group-exec file finsert, only sgid
+2676 -rw-rwsrw- TEST_DIR/686/a
+676 -rw-rwxrw- TEST_DIR/686/a
+
+Test 11 - qa_user, user-exec file finsert, only sgid
+2766 -rwxrwSrw- TEST_DIR/686/a
+2766 -rwxrwSrw- TEST_DIR/686/a
+
+Test 12 - qa_user, all-exec file finsert, only sgid
+2777 -rwxrwsrwx TEST_DIR/686/a
+777 -rwxrwxrwx TEST_DIR/686/a
+
index 7bdfcd5c099060383b5e0282006b804c371261d0..0bd421e5ec32196bd19fecfb1f6aa55c09d656c3 100755 (executable)
@@ -61,67 +61,78 @@ commit_and_check() {
        echo
 }
 
-nr=0
-# Commit to a non-exec file by an unprivileged user clears suid but
-# leaves sgid.
-nr=$((nr + 1))
-echo "Test $nr - qa_user, non-exec file $verb"
+# Commit to a non-exec file by an unprivileged user clears suid and sgid.
+echo "Test 1 - qa_user, non-exec file $verb"
 setup_testfile
 chmod a+rws $junk_file
 commit_and_check "$qa_user" "$verb" 64k 64k
 
-# Commit to a group-exec file by an unprivileged user clears suid and
-# sgid.
-nr=$((nr + 1))
-echo "Test $nr - qa_user, group-exec file $verb"
+# Commit to a group-exec file by an unprivileged user clears suid and sgid.
+echo "Test 2 - qa_user, group-exec file $verb"
 setup_testfile
 chmod g+x,a+rws $junk_file
 commit_and_check "$qa_user" "$verb" 64k 64k
 
-# Commit to a user-exec file by an unprivileged user clears suid but
-# not sgid.
-nr=$((nr + 1))
-echo "Test $nr - qa_user, user-exec file $verb"
+# Commit to a user-exec file by an unprivileged user clears suid and sgid.
+echo "Test 3 - qa_user, user-exec file $verb"
 setup_testfile
 chmod u+x,a+rws,g-x $junk_file
 commit_and_check "$qa_user" "$verb" 64k 64k
 
-# Commit to a all-exec file by an unprivileged user clears suid and
-# sgid.
-nr=$((nr + 1))
-echo "Test $nr - qa_user, all-exec file $verb"
+# Commit to a all-exec file by an unprivileged user clears suid and sgid.
+echo "Test 4 - qa_user, all-exec file $verb"
 setup_testfile
 chmod a+rwxs $junk_file
 commit_and_check "$qa_user" "$verb" 64k 64k
 
-# Commit to a non-exec file by root clears suid but leaves sgid.
-nr=$((nr + 1))
-echo "Test $nr - root, non-exec file $verb"
+# Commit to a non-exec file by root leaves suid and sgid.
+echo "Test 5 - root, non-exec file $verb"
 setup_testfile
 chmod a+rws $junk_file
 commit_and_check "" "$verb" 64k 64k
 
-# Commit to a group-exec file by root clears suid and sgid.
-nr=$((nr + 1))
-echo "Test $nr - root, group-exec file $verb"
+# Commit to a group-exec file by root leaves suid and sgid.
+echo "Test 6 - root, group-exec file $verb"
 setup_testfile
 chmod g+x,a+rws $junk_file
 commit_and_check "" "$verb" 64k 64k
 
-# Commit to a user-exec file by root clears suid but not sgid.
-nr=$((nr + 1))
-echo "Test $nr - root, user-exec file $verb"
+# Commit to a user-exec file by root leaves suid and sgid.
+echo "Test 7 - root, user-exec file $verb"
 setup_testfile
 chmod u+x,a+rws,g-x $junk_file
 commit_and_check "" "$verb" 64k 64k
 
-# Commit to a all-exec file by root clears suid and sgid.
-nr=$((nr + 1))
-echo "Test $nr - root, all-exec file $verb"
+# Commit to a all-exec file by root leaves suid and sgid.
+echo "Test 8 - root, all-exec file $verb"
 setup_testfile
 chmod a+rwxs $junk_file
 commit_and_check "" "$verb" 64k 64k
 
+# Commit to a non-exec file by an unprivileged user leaves sgid.
+echo "Test 9 - qa_user, non-exec file $verb, only sgid"
+setup_testfile
+chmod a+rw,g+rws $junk_file
+commit_and_check "$qa_user" "$verb" 64k 64k
+
+# Commit to a group-exec file by an unprivileged user clears sgid
+echo "Test 10 - qa_user, group-exec file $verb, only sgid"
+setup_testfile
+chmod a+rw,g+rwxs $junk_file
+commit_and_check "$qa_user" "$verb" 64k 64k
+
+# Commit to a user-exec file by an unprivileged user clears sgid
+echo "Test 11 - qa_user, user-exec file $verb, only sgid"
+setup_testfile
+chmod a+rw,u+x,g+rws $junk_file
+commit_and_check "$qa_user" "$verb" 64k 64k
+
+# Commit to a all-exec file by an unprivileged user clears sgid.
+echo "Test 12 - qa_user, all-exec file $verb, only sgid"
+setup_testfile
+chmod a+rwx,g+rwxs $junk_file
+commit_and_check "$qa_user" "$verb" 64k 64k
+
 # success, all done
 status=0
 exit
index 7f945d7287bec5b9ccb3ff7be66fb66ac05d4fcc..c5116c2794220ac89ebd44c142725e5ebb0b8196 100644 (file)
@@ -31,3 +31,19 @@ Test 8 - root, all-exec file fcollapse
 6777 -rwsrwsrwx TEST_DIR/687/a
 6777 -rwsrwsrwx TEST_DIR/687/a
 
+Test 9 - qa_user, non-exec file fcollapse, only sgid
+2666 -rw-rwSrw- TEST_DIR/687/a
+2666 -rw-rwSrw- TEST_DIR/687/a
+
+Test 10 - qa_user, group-exec file fcollapse, only sgid
+2676 -rw-rwsrw- TEST_DIR/687/a
+676 -rw-rwxrw- TEST_DIR/687/a
+
+Test 11 - qa_user, user-exec file fcollapse, only sgid
+2766 -rwxrwSrw- TEST_DIR/687/a
+2766 -rwxrwSrw- TEST_DIR/687/a
+
+Test 12 - qa_user, all-exec file fcollapse, only sgid
+2777 -rwxrwsrwx TEST_DIR/687/a
+777 -rwxrwxrwx TEST_DIR/687/a
+