]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: torture: Run the SMB1-SYSTEM-SECURITY test.
authorJeremy Allison <jra@samba.org>
Sat, 18 Apr 2020 00:36:10 +0000 (17:36 -0700)
committerJeremy Allison <jra@samba.org>
Tue, 21 Apr 2020 18:37:39 +0000 (18:37 +0000)
Calls the test in the previous commit by adding
SeSecurityPrivilege first, running the SMB1-SYSTEM-SECURITY
test then removing SeSecurityPrivilege.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/script/tests/test_smb1_system_security.sh [new file with mode: 0755]
source3/selftest/tests.py

diff --git a/source3/script/tests/test_smb1_system_security.sh b/source3/script/tests/test_smb1_system_security.sh
new file mode 100755 (executable)
index 0000000..4c678b3
--- /dev/null
@@ -0,0 +1,43 @@
+#!/bin/sh
+#
+# Runs the smbtorture3 SMB1-SYSTEM-SECURITY test
+# that requres 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-secuirity" 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
index 568434a208c8e5ec8e941b11e4dedd6f3e8ec2f6..e693f50dc30e7fb9c2eea9e8c6415cec18e56091 100755 (executable)
@@ -412,6 +412,9 @@ for env in ["fileserver"]:
     plantestsuite("samba3.blackbox.timestamps", env,
                   [os.path.join(samba3srcdir, "script/tests/test_timestamps.sh"),
                    '$SERVER_IP', '$USERNAME', '$PASSWORD', '$LOCAL_PATH', smbclient3])
+    plantestsuite("samba3.blackbox.smb1_system_security", env + "_smb1_done",
+                  [os.path.join(samba3srcdir, "script/tests/test_smb1_system_security.sh"),
+                   '$SERVER', '$SERVER_IP', '$USERNAME', '$PASSWORD', smbtorture3, net, 'tmp'])
 
     #
     # tar command tests