diff options
author | Christof Schmitt <cs@samba.org> | 2018-04-24 13:52:59 -0700 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2018-05-07 09:57:26 +0200 |
commit | 0797e58833d7b4880df7e3ff9d76802952278175 (patch) | |
tree | 2595f37334ec270701bc534b894b36a32fe7daac /source3 | |
parent | cfbcd62a54b07a7fc7932eef3526dd33f8aa5a15 (diff) | |
download | samba-0797e58833d7b4880df7e3ff9d76802952278175.tar.gz |
selftest: Add testcase for querying sessions after smbd crash
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13407
Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit e04846c7df8e3eec1f3dbb2fc5eaf47ceb1c44d2)
Diffstat (limited to 'source3')
-rwxr-xr-x | source3/script/tests/test_rpcclient_netsessenum.sh | 55 | ||||
-rwxr-xr-x | source3/selftest/tests.py | 6 |
2 files changed, 61 insertions, 0 deletions
diff --git a/source3/script/tests/test_rpcclient_netsessenum.sh b/source3/script/tests/test_rpcclient_netsessenum.sh new file mode 100755 index 00000000000..9abb3ae3db5 --- /dev/null +++ b/source3/script/tests/test_rpcclient_netsessenum.sh @@ -0,0 +1,55 @@ +#!/bin/sh +# +# Blackbox tests for the rpcclient srvsvc commands +# +# Copyright (C) 2018 Christof Schmitt + +if [ $# -lt 6 ]; then +cat <<EOF +Usage: $0 DOMAIN ADMIN_USER ADMIN_PASSWORD SERVER RPCCLIENT SMBTORTURE3 SHARE +EOF +exit 1; +fi + +DOMAIN="$1" +ADMIN_USER="$2" +ADMIN_PASSWORD="$3" +SERVER="$4" +RPCCLIENT="$5" +SMBTORTURE3="$6" +SHARE="$7" + +USERPASS="-U$DOMAIN/$ADMIN_USER%$ADMIN_PASSWORD" +RPCCLIENTCMD="$RPCCLIENT $SERVER $USERPASS" + +incdir=$(dirname $0)/../../../testprogs/blackbox +. $incdir/subunit.sh + +failed=0 + +# +# Verify initial number of sessions. +# +$RPCCLIENTCMD -c NetSessEnum | grep Received +RC=$? +testit "netsessenum" test $RC = 0 || failed=$(expr $failed + 1) + +OUT=$($RPCCLIENTCMD -c NetSessEnum | grep Received) +test "$OUT" = "Received 1 entries." +RC=$? +testit "count1" test $RC -eq 0 || failed=$(expr $failed + 1) + +# +# Inject smbd crash +# +$SMBTORTURE3 //"$SERVER"/"$SHARE" "$USERPASS" CLEANUP1 + +# +# Verify number of sessions after crash +# +OUT=$($RPCCLIENTCMD -c NetSessEnum | grep Received) +test "$OUT" = "Received 1 entries." +RC=$? +testit "count2" test $RC -eq 0 || failed=$(expr $failed + 1) + +testok $0 $failed diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py index 593ac1d2e2d..20e1c03fa66 100755 --- a/source3/selftest/tests.py +++ b/source3/selftest/tests.py @@ -612,6 +612,12 @@ plantestsuite("samba3.blackbox.smbclient.encryption_off", "simpleserver", "$USERNAME", "$PASSWORD", "$SERVER", smbclient3]) +plantestsuite("samba3.blackbox.rpcclient_netsessenum", "ad_member", + [os.path.join(samba3srcdir, + "script/tests/test_rpcclient_netsessenum.sh"), + "$DOMAIN", "$DC_USERNAME", "$DC_PASSWORD", "$SERVER", + os.path.join(bindir(), "rpcclient"), smbtorture3, "tmp"]) + # The ktest environment uses: # server min protocol = SMB3_00 # client max protocol = SMB3 |