summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2021-01-28 14:07:23 -0800
committerKarolin Seeger <kseeger@samba.org>2021-02-05 11:15:10 +0000
commita00ff4345157f8d04b7c58325a3e877a9d1f9a95 (patch)
tree869618011a8a951604ac3a4169b1c324fd2a15a9
parent8c846741a4514fc01513ddd3f83afc61f186806a (diff)
downloadsamba-a00ff4345157f8d04b7c58325a3e877a9d1f9a95.tar.gz
s3: tests: Add regression test for bug 13992.
Subtle extra test. Mark as knownfail for now. '^ user1$' must appear MORE THAN ONCE, as it can read more than one share. The previous test found user1, but only once as the bug only allows reading the security descriptor for one share, and we were unlucky that the first share security descriptor returned allows user1 to read from it. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13992 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> (cherry picked from commit 068f4a977f0539f790809d580bf22d2362032e3d)
-rw-r--r--selftest/knownfail.d/bug-139922
-rwxr-xr-xsource3/script/tests/test_net_rpc_share_allowedusers.sh20
2 files changed, 22 insertions, 0 deletions
diff --git a/selftest/knownfail.d/bug-13992 b/selftest/knownfail.d/bug-13992
new file mode 100644
index 00000000000..76365f09303
--- /dev/null
+++ b/selftest/knownfail.d/bug-13992
@@ -0,0 +1,2 @@
+# bug 13992
+^samba3.blackbox.net_rpc_share_allowedusers.net_rpc_share_allowedusers\(nt4_dc\)
diff --git a/source3/script/tests/test_net_rpc_share_allowedusers.sh b/source3/script/tests/test_net_rpc_share_allowedusers.sh
index 5dd382d4c51..d22c7580681 100755
--- a/source3/script/tests/test_net_rpc_share_allowedusers.sh
+++ b/source3/script/tests/test_net_rpc_share_allowedusers.sh
@@ -26,5 +26,25 @@ testit_grep "net_rpc_share_allowedusers" '^print\$$' $net usersidlist | $VALGRIN
testit_grep "net_rpc_share_allowedusers" '^print\$$' $net usersidlist | $VALGRIND $net rpc share allowedusers -S$SERVER -U$USERNAME%$PASSWORD $ADDARGS - 'print$' || failed=`expr $failed + 1`
# Check user "user1" is allowed to read share "tmp".
testit_grep "net_rpc_share_allowedusers" '^ user1$' $net usersidlist | $VALGRIND $net rpc share allowedusers -S$SERVER -U$USERNAME%$PASSWORD $ADDARGS || failed=`expr $failed + 1`
+#
+# Subtle extra test for bug https://bugzilla.samba.org/show_bug.cgi?id=13992
+#
+# '^ user1$' must appear MORE THAN ONCE, as it can read more than one
+# share. The previous test found user1, but only once as the bug only
+# allows reading the security descriptor for one share, and we were
+# unlucky that the first share security descriptor returned allows
+# user1 to read from it.
+#
+subunit_start_test "net_rpc_share_allowedusers"
+multi_userout=`$net usersidlist | $VALGRIND $net rpc share allowedusers -S$SERVER -U$USERNAME%$PASSWORD $ADDARGS`
+num_matches=`echo "$multi_userout" | grep -c '^ user1$'`
+if [ "$num_matches" -gt "1" ]
+then
+ subunit_pass_test "net_rpc_share_allowedusers"
+else
+ echo "net_rpc_share_allowedusers only found $num_matches shares readable by user1. Should be greater than one.\n"
+ failed=`expr $failed + 1`
+ echo "$multi_userout" | subunit_fail_test "net_rpc_share_allowedusers"
+fi
testok $0 $failed