From: Stefan Metzmacher Date: Wed, 31 Aug 2022 12:04:10 +0000 (+0200) Subject: s3:tests: add test_smbXsrv_client_cross_node.sh X-Git-Tag: talloc-2.4.0~1209 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0efcfaa49c3d61f2c8116ebafd55b72d3277d0d8;p=thirdparty%2Fsamba.git s3:tests: add test_smbXsrv_client_cross_node.sh This demonstrates that a client-guid connected to ctdb node 0 caused a connection with the same client-guid to be rejected by ctdb node 1. Node 1 rejects the SMB2 Negotiate with NT_STATUS_NOT_SUPPORTED, because passing the multi-channel connection to a different node is not supported. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15159 Signed-off-by: Stefan Metzmacher Reviewed-by: Jeremy Allison --- diff --git a/selftest/knownfail.d/bug_15159 b/selftest/knownfail.d/bug_15159 new file mode 100644 index 00000000000..5ecd8b1a66e --- /dev/null +++ b/selftest/knownfail.d/bug_15159 @@ -0,0 +1 @@ +samba3.blackbox.smbXsrv_client_cross_node.smbclient.against.node1 diff --git a/source3/script/tests/test_smbXsrv_client_cross_node.sh b/source3/script/tests/test_smbXsrv_client_cross_node.sh new file mode 100755 index 00000000000..ff826924b49 --- /dev/null +++ b/source3/script/tests/test_smbXsrv_client_cross_node.sh @@ -0,0 +1,95 @@ +#!/bin/bash +# +# Test smbd let cluster node 0 destroy the connection, +# if the client with a specific client-guid connections to node 1 +# + +if [ $# -lt 4 ]; then + echo Usage: test_smbXsrv_client_cross_node.sh SERVERCONFFILE NODE0 NODE1 SHARENAME + exit 1 +fi + +CONF=$1 +NODE0=$2 +NODE1=$3 +SHARE=$4 + +SMBCLIENT="$BINDIR/smbclient" +SMBSTATUS="$BINDIR/smbstatus" + +incdir=$(dirname "$0")/../../../testprogs/blackbox +. "$incdir"/subunit.sh + +failed=0 + +test_smbclient() +{ + name="$1" + server="$2" + share="$3" + cmd="$4" + shift + shift + subunit_start_test "$name" + output=$($VALGRIND $SMBCLIENT //$server/$share -c "$cmd" "$@" 2>&1) + status=$? + if [ x$status = x0 ]; then + subunit_pass_test "$name" + else + echo "$output" | subunit_fail_test "$name" + fi + return $status +} + +cd "$SELFTEST_TMPDIR" || exit 1 + +# Create the smbclient communication pipes. +rm -f smbclient-stdin smbclient-stdout smbclient-stderr +mkfifo smbclient-stdin smbclient-stdout smbclient-stderr + +UID_WRAPPER_ROOT=1 +export UID_WRAPPER_ROOT + +smbstatus_num_sessions() +{ + UID_WRAPPER_INITIAL_RUID=0 UID_WRAPPER_INITIAL_EUID=0 "$SMBSTATUS" "$CONF" --json | jq -M '.sessions | length' +} + +testit_grep "step1: smbstatus 0 sessions" '^0$' smbstatus_num_sessions || failed=$(expr $failed + 1) + +test_smbclient "smbclient against node0[${NODE0}]" "${NODE0}" "${SHARE}" "ls" -U"${DC_USERNAME}"%"${DC_PASSWORD}" \ + --option="libsmb:client_guid=6112f7d3-9528-4a2a-8861-0ca129aae6c4" \ + || failed=$(expr $failed + 1) + +testit_grep "step2: smbstatus 0 sessions" '^0$' smbstatus_num_sessions || failed=$(expr $failed + 1) + +CLI_FORCE_INTERACTIVE=1 +export CLI_FORCE_INTERACTIVE + +testit "start backgroup smbclient against node0[${NODE0}]" true || failed=$(expr $failed + 1) + +# Connect a first time +${SMBCLIENT} //"${NODE0}"/"${SHARE}" -U"${DC_USERNAME}"%"${DC_PASSWORD}" \ + --option="libsmb:client_guid=6112f7d3-9528-4a2a-8861-0ca129aae6c4" \ + smbclient-stdout 2>smbclient-stderr & +CLIENT_PID=$! + +exec 100>smbclient-stdin 101