[SCM] Samba Shared Repository - branch v4-14-test updated
Jule Anger
janger at samba.org
Thu Aug 26 16:04:01 UTC 2021
The branch, v4-14-test has been updated
via 07b062c489f s3/rpc_server: track the number of policy handles with a talloc destructor
via 5500f3ab7fe selftest: add a test for the "deadtime" parameter
via 4fbd8a22c3d s3: smbd: Ensure all returns from OpenDir() correctly set errno.
from e8807cc57e7 VERSION: Bump version up to 4.14.8...
https://git.samba.org/?p=samba.git;a=shortlog;h=v4-14-test
- Log -----------------------------------------------------------------
commit 07b062c489ffe926f14a65da9540c31aea909315
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-14-test): Jule Anger <janger at samba.org>
Autobuild-Date(v4-14-test): Thu Aug 26 16:03:40 UTC 2021 on sn-devel-184
commit 5500f3ab7fe7bbfa8f952e29140f784a0c9bc363
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)
commit 4fbd8a22c3df7fe9ac4d0f17590a1b6fbdb906d3
Author: Jeremy Allison <jra at samba.org>
Date: Thu Aug 19 15:43:52 2021 -0700
s3: smbd: Ensure all returns from OpenDir() correctly set errno.
Complex code paths inside open_internal_dirfsp() can return an
NTSTATUS, but trample on the matching errno. We need to make
sure if open_internal_dirfsp() fails, errno matches the NTSTATUS
return.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14805
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Noel Power <npower at samba.org>
Autobuild-User(master): Noel Power <npower at samba.org>
Autobuild-Date(master): Fri Aug 20 09:56:49 UTC 2021 on sn-devel-184
(cherry picked from commit 72b4fe93f15e414ca3e7d7f0e77a5f0aae90556a)
-----------------------------------------------------------------------
Summary of changes:
source3/rpc_server/rpc_handles.c | 20 +++++++++--
source3/script/tests/test_deadtime.sh | 67 +++++++++++++++++++++++++++++++++++
source3/selftest/tests.py | 4 +++
source3/smbd/dir.c | 2 ++
4 files changed, 91 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 533b58d6d9c..b40d02d6c1d 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -1030,6 +1030,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")])
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c
index 6614b4d4c47..545c7499f28 100644
--- a/source3/smbd/dir.c
+++ b/source3/smbd/dir.c
@@ -1484,6 +1484,8 @@ struct smb_Dir *OpenDir(TALLOC_CTX *mem_ctx,
O_RDONLY,
&fsp);
if (!NT_STATUS_IS_OK(status)) {
+ /* Ensure we return the actual error from status in errno. */
+ errno = map_errno_from_nt_status(status);
return NULL;
}
--
Samba Shared Repository
More information about the samba-cvs
mailing list