]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:smbd: setup parent->transports from 'smb ports'
authorStefan Metzmacher <metze@samba.org>
Thu, 3 Apr 2025 13:39:40 +0000 (15:39 +0200)
committerStefan Metzmacher <metze@samba.org>
Fri, 18 Apr 2025 10:17:29 +0000 (10:17 +0000)
This will be used in the next commits and in the
end derived from the 'server smb transports' option.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
source3/smbd/server.c

index 473002221dc5af9fae7cec4015c8288506d73fa7..ab8248aee03360708d3554f3a47e3af27cd4b4fa 100644 (file)
@@ -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,