From 8daa83a594a2e98f39d764422bfbdbc62c9efd44 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 19:20:00 +0200 Subject: Adding upstream version 2:4.20.0+dfsg. Signed-off-by: Daniel Baumann --- source3/script/tests/test_smb1_system_security.sh | 44 +++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100755 source3/script/tests/test_smb1_system_security.sh (limited to 'source3/script/tests/test_smb1_system_security.sh') diff --git a/source3/script/tests/test_smb1_system_security.sh b/source3/script/tests/test_smb1_system_security.sh new file mode 100755 index 0000000..dac8897 --- /dev/null +++ b/source3/script/tests/test_smb1_system_security.sh @@ -0,0 +1,44 @@ +#!/bin/sh +# +# Runs the smbtorture3 SMB1-SYSTEM-SECURITY test +# that requires SeSecurityPrivilege against Samba. +# + +if [ $# -lt 7 ]; then + echo "Usage: $0 SERVER SERVER_IP USERNAME PASSWORD SMBTORTURE3 NET SHARE" + exit 1 +fi + +SERVER="$1" +SERVER_IP="$2" +USERNAME="$3" +PASSWORD="$4" +SMBTORTURE3="$5" +NET="$6" +SHARE="$7" + +failed=0 + +incdir=$(dirname $0)/../../../testprogs/blackbox +. $incdir/subunit.sh + +smb1_system_security() +{ + out=$($SMBTORTURE3 //$SERVER_IP/$SHARE -U $USERNAME%$PASSWORD -mNT1 SMB1-SYSTEM-SECURITY) + if [ $? -ne 0 ]; then + echo "SMB1-SYSTEM-SECURITY failed" + echo "$out" + return 1 + fi +} + +# Grant SeSecurityPrivilege to the user +testit "grant SeSecurityPrivilege" $NET rpc rights grant $USERNAME SeSecurityPrivilege -U $USERNAME%$PASSWORD -I $SERVER_IP || failed=$(expr $failed + 1) + +# Run the test. +testit "smb1-system-security" smb1_system_security || failed=$(expr $failed + 1) + +# Revoke SeSecurityPrivilege +testit "revoke SeSecurityPrivilege" $NET rpc rights revoke $USERNAME SeSecurityPrivilege -U $USERNAME%$PASSWORD -I $SERVER_IP || failed=$(expr $failed + 1) + +exit $failed -- cgit v1.2.3