[SCM] Samba Shared Repository - branch v4-13-test updated

Jule Anger janger at samba.org
Fri Aug 27 08:42:01 UTC 2021


The branch, v4-13-test has been updated
       via  6be92d44bb7 s3/rpc_server: track the number of policy handles with a talloc destructor
       via  f25f3118593 selftest: add a test for the "deadtime" parameter
      from  23ce76e94e8 s3:libsmb: start encryption as soon as possible after the session setup

https://git.samba.org/?p=samba.git;a=shortlog;h=v4-13-test


- Log -----------------------------------------------------------------
commit 6be92d44bb7a7fbfb524b75102e562a5dccff6ae
Author: Ralph Boehme <slow at 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 <slow at samba.org>
    Reviewed-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at 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-13-test): Jule Anger <janger at samba.org>
    Autobuild-Date(v4-13-test): Fri Aug 27 08:41:19 UTC 2021 on sn-devel-184

commit f25f3118593dbf35553c3e9b7ae15483b8155d22
Author: Ralph Boehme <slow at 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 <slow at samba.org>
    Reviewed-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Jeremy Allison <jra at 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 bcf8f240f63..7e7a40079cc 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);
 	}
@@ -204,8 +222,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 47e914b1009..90bda2052af 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -984,6 +984,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



More information about the samba-cvs mailing list