From 1f3f8c4a6ba837e24e7a12193415c70140a1cb28 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 3 Apr 2025 15:39:40 +0200 Subject: [PATCH] s3:smbd: setup parent->transports from 'smb ports' This will be used in the next commits and in the end derived from the 'server smb transports' option. Signed-off-by: Stefan Metzmacher Reviewed-by: Volker Lendecke --- source3/smbd/server.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/source3/smbd/server.c b/source3/smbd/server.c index 473002221dc..ab8248aee03 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -74,6 +74,8 @@ struct smbd_parent_context { struct tevent_context *ev_ctx; struct messaging_context *msg_ctx; + struct smb_transports transports; + /* the list of listening sockets */ struct smbd_open_socket *sockets; @@ -2108,6 +2110,26 @@ extern void build_options(bool screen); parent->msg_ctx = msg_ctx; am_parent = parent; + if (ports != NULL) { + const char **ts = NULL; + char **l = NULL; + l = str_list_make_v3(talloc_tos(), ports, NULL); + ts = discard_const_p(const char *, l); + parent->transports = smb_transports_parse("--ports", + ts); + if (parent->transports.num_transports == 0) { + exit_server("no valid transport from '--ports'"); + } + } else { + const char **ts = lp_smb_ports(); + parent->transports = smb_transports_parse("smb ports", + ts); + if (parent->transports.num_transports == 0) { + exit_server("no valid transport from " + "'smb ports'"); + } + } + se = tevent_add_signal(parent->ev_ctx, parent, SIGTERM, 0, -- 2.47.3