From: Stefan Metzmacher Date: Thu, 3 Apr 2025 12:37:02 +0000 (+0200) Subject: s3:smbd: only do dns_port logic in one central place. X-Git-Tag: tevent-0.17.0~301 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b8d76d07393cd7ca1db30440f91aa8c9ee26235e;p=thirdparty%2Fsamba.git s3:smbd: only do dns_port logic in one central place. Signed-off-by: Stefan Metzmacher Reviewed-by: Volker Lendecke --- diff --git a/source3/smbd/server.c b/source3/smbd/server.c index abd53e23c05..b966739cff6 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -1178,6 +1178,13 @@ static bool open_sockets_smbd(struct smbd_parent_context *parent, exit_server_cleanly("Invalid port in the config or on " "the commandline specified!"); } + + /* Keep the first port for mDNS service + * registration. + */ + if (dns_port == 0) { + dns_port = port; + } } if (lp_interfaces() && lp_bind_interfaces_only()) { @@ -1201,13 +1208,6 @@ static bool open_sockets_smbd(struct smbd_parent_context *parent, for (j = 0; ports && ports[j]; j++) { unsigned port = atoi(ports[j]); - /* Keep the first port for mDNS service - * registration. - */ - if (dns_port == 0) { - dns_port = port; - } - if (!smbd_open_one_socket(parent, ev_ctx, ifss, @@ -1236,13 +1236,6 @@ static bool open_sockets_smbd(struct smbd_parent_context *parent, struct sockaddr_storage ss; unsigned port = atoi(ports[j]); - /* Keep the first port for mDNS service - * registration. - */ - if (dns_port == 0) { - dns_port = port; - } - /* open an incoming socket */ if (!interpret_string_addr(&ss, sock_tok, AI_NUMERICHOST|AI_PASSIVE)) {