diff options
author | Olly Betts <olly@survex.com> | 2018-11-28 09:09:51 +1300 |
---|---|---|
committer | Douglas Bagnall <dbagnall@samba.org> | 2018-11-30 03:35:13 +0100 |
commit | 06061d39c1031b223edc126ccb960ceb4b0b3d59 (patch) | |
tree | 16cdee8f781f3bc9b92b7b8f1ecb19b01b309c0c | |
parent | 3d9ba1b7e6cbc0833b8ff2f92673c9403b6f9038 (diff) | |
download | samba-06061d39c1031b223edc126ccb960ceb4b0b3d59.tar.gz |
Add simple tests for net rpc share allowedusers
Signed-off-by: Olly Betts <olly@survex.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
-rwxr-xr-x | source3/script/tests/test_net_rpc_share_allowedusers.sh | 30 | ||||
-rwxr-xr-x | source3/selftest/tests.py | 5 |
2 files changed, 35 insertions, 0 deletions
diff --git a/source3/script/tests/test_net_rpc_share_allowedusers.sh b/source3/script/tests/test_net_rpc_share_allowedusers.sh new file mode 100755 index 00000000000..5dd382d4c51 --- /dev/null +++ b/source3/script/tests/test_net_rpc_share_allowedusers.sh @@ -0,0 +1,30 @@ +#!/bin/sh + +if [ $# -lt 4 ]; then +cat <<EOF +Usage: test_net_rpc_share_allowedusers.sh SERVER USERNAME PASSWORD PREFIX +EOF +exit 1; +fi + +SERVER="$1" +USERNAME="$2" +PASSWORD="$3" +PREFIX="$4" +shift 4 +ADDARGS="$*" + +incdir=`dirname $0`/../../../testprogs/blackbox +. $incdir/subunit.sh +mkdir -p $PREFIX/private +net=$BINDIR/net +# Check for the SID for group "Everyone" as a basic test things are working. +testit_grep "net_usersidlist" '^ S-1-1-0$' $VALGRIND $net usersidlist $ADDARGS || failed=`expr $failed + 1` +# Check "print$" share is listed by default. +testit_grep "net_rpc_share_allowedusers" '^print\$$' $net usersidlist | $VALGRIND $net rpc share allowedusers -S$SERVER -U$USERNAME%$PASSWORD $ADDARGS || failed=`expr $failed + 1` +# Check "print$" share is listed if we ask for it. +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` + +testok $0 $failed diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py index 1dfe4cdf184..f30b03ce990 100755 --- a/source3/selftest/tests.py +++ b/source3/selftest/tests.py @@ -706,6 +706,11 @@ plantestsuite("samba3.blackbox.net_cache_samlogon", "ad_member:local", [os.path.join(samba3srcdir, "script/tests/test_net_cache_samlogon.sh"), '$SERVER', 'tmp', '$DC_USERNAME', '$DC_PASSWORD']) +plantestsuite("samba3.blackbox.net_rpc_share_allowedusers", "nt4_dc", + [os.path.join(samba3srcdir, "script/tests/test_net_rpc_share_allowedusers.sh"), + "$SERVER", "$USERNAME", "$PASSWORD", "$PREFIX/net_rpc_share_allowedusers", + configuration]) + plantestsuite("samba3.blackbox.net_dom_join_fail_dc", "nt4_dc", [os.path.join(samba3srcdir, "script/tests/test_net_dom_join_fail_dc.sh"), "$USERNAME", "$PASSWORD", "$SERVER", "$PREFIX/net_dom_join_fail_dc", |