The branch, v4-15-test has been updated via e0dc3168210 s3/rpc_server: track the number of policy handles with a talloc destructor via 1e56dc7dd19 selftest: add a test for the "deadtime" parameter from 068bdf8fbfb VERSION: Bump version up to Samba 4.15.0rc4...
https://git.samba.org/?p=samba.git;a=shortlog;h=v4-15-test - Log ----------------------------------------------------------------- commit e0dc316821092b133e1c01759f4e759052fd1abc Author: Ralph Boehme <s...@samba.org> Date: Mon Aug 9 15:12:31 2021 +0200 s3/rpc_server: track the number of policy handles with a talloc destructor BUG: https://bugzilla.samba.org/show_bug.cgi?id=14783 RN: smbd "deadtime" parameter doesn't work anymore Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Samuel Cabrero <scabr...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> Autobuild-User(master): Jeremy Allison <j...@samba.org> Autobuild-Date(master): Tue Aug 10 18:41:43 UTC 2021 on sn-devel-184 (cherry picked from commit 45a33b25c4e6b1db5d2dfa6297ccb390220a7c80) Autobuild-User(v4-15-test): Jule Anger <jan...@samba.org> Autobuild-Date(v4-15-test): Thu Aug 26 14:30:56 UTC 2021 on sn-devel-184 commit 1e56dc7dd19c84fe164cfbeb9c2c9aaa1beff004 Author: Ralph Boehme <s...@samba.org> Date: Mon Aug 9 12:31:07 2021 +0200 selftest: add a test for the "deadtime" parameter BUG: https://bugzilla.samba.org/show_bug.cgi?id=14783 Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Samuel Cabrero <scabr...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> (cherry picked from commit 39db53a1391769fc6476fa55b02add08f1b8cd75) ----------------------------------------------------------------------- Summary of changes: source3/rpc_server/rpc_handles.c | 20 +++++++++-- source3/script/tests/test_deadtime.sh | 67 +++++++++++++++++++++++++++++++++++ source3/selftest/tests.py | 4 +++ 3 files changed, 89 insertions(+), 2 deletions(-) create mode 100755 source3/script/tests/test_deadtime.sh Changeset truncated at 500 lines: diff --git a/source3/rpc_server/rpc_handles.c b/source3/rpc_server/rpc_handles.c index 9ef93231466..745ea4dd6ef 100644 --- a/source3/rpc_server/rpc_handles.c +++ b/source3/rpc_server/rpc_handles.c @@ -103,18 +103,36 @@ size_t num_pipe_handles(void) data_ptr is TALLOC_FREE()'ed ****************************************************************************/ +struct hnd_cnt { + bool _dummy; +}; + +static int hnd_cnt_destructor(struct hnd_cnt *cnt) +{ + num_handles--; + return 0; +} + bool create_policy_hnd(struct pipes_struct *p, struct policy_handle *hnd, uint8_t handle_type, void *data_ptr) { struct dcesrv_handle *rpc_hnd = NULL; + struct hnd_cnt *cnt = NULL; rpc_hnd = dcesrv_handle_create(p->dce_call, handle_type); if (rpc_hnd == NULL) { return false; } + cnt = talloc_zero(rpc_hnd, struct hnd_cnt); + if (cnt == NULL) { + TALLOC_FREE(rpc_hnd); + return false; + } + talloc_set_destructor(cnt, hnd_cnt_destructor); + if (data_ptr != NULL) { rpc_hnd->data = talloc_move(rpc_hnd, &data_ptr); } @@ -205,8 +223,6 @@ bool close_policy_hnd(struct pipes_struct *p, TALLOC_FREE(rpc_hnd); - num_handles--; - return true; } diff --git a/source3/script/tests/test_deadtime.sh b/source3/script/tests/test_deadtime.sh new file mode 100755 index 00000000000..68703008f02 --- /dev/null +++ b/source3/script/tests/test_deadtime.sh @@ -0,0 +1,67 @@ +#!/usr/bin/env bash +# +# Test deadtime parameter +# + +if [ $# -lt 1 ]; then + echo Usage: test_deadtime.sh IP + exit 1 +fi + +server=$1 + +incdir=`dirname $0`/../../../testprogs/blackbox +. $incdir/subunit.sh +. $incdir/common_test_fns.inc + +failed=0 + +smbclient="$BINDIR/smbclient" +smbcontrol="$BINDIR/smbcontrol" + +global_inject_conf=$(dirname $SMB_CONF_PATH)/global_inject.conf + +echo "deadtime = 1" > $global_inject_conf +$smbcontrol smbd reload-config + +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 + +export CLI_FORCE_INTERACTIVE=1 +export SAMBA_DEPRECATED_SUPPRESS=1 + +# This gets inherited by smbclient and is required to smbclient doesn't get +# killed by an unhandled SIGPIPE when writing an SMB2 KEEPALIVE packet to the +# connection fd that was already closed by the server. +trap "" SIGPIPE + +$smbclient //$server/tmp -U${USER}%${PASSWORD} \ + < smbclient-stdin > smbclient-stdout 2>smbclient-stderr & +client_pid=$! + +sleep 1 + +exec 100>smbclient-stdin 101<smbclient-stdout 102<smbclient-stderr + +# consume the smbclient startup message +head -n 1 <&101 + +sleep 70 + +err=$(head -n 1 <&102) +echo "err: $err" + +kill $client_pid + +echo "$err" | grep NT_STATUS_CONNECTION_DISCONNECTED +testit "deadtime" test $? -eq 0 || failed=$(expr $failed + 1) + +echo "" > $global_inject_conf +$smbcontrol smbd reload-config + +rm -f smbclient-stdin smbclient-stdout smbclient-stderr + +testok $0 $failed diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py index 687a9d9e875..d7f383a0e05 100755 --- a/source3/selftest/tests.py +++ b/source3/selftest/tests.py @@ -1097,6 +1097,10 @@ plantestsuite("samba3.blackbox.aio-outstanding", "simpleserver:local", '$SERVER_IP', "aio_delay_inject"]) +plantestsuite("samba3.blackbox.deadtime", "simpleserver:local", + [os.path.join(samba3srcdir, "script/tests/test_deadtime.sh"), + '$SERVER_IP']) + plantestsuite("samba3.blackbox.smbd_error", "simpleserver:local", [os.path.join(samba3srcdir, "script/tests/test_smbd_error.sh")]) -- Samba Shared Repository