From: Stefan Metzmacher Date: Thu, 21 May 2026 14:48:58 +0000 (+0200) Subject: s3:utils: let net_update_dns_internal() use c->opt_host to force a specific DC X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1ee84a2cf535d7b5fbcc2cd4710a7d866ee29d05;p=thirdparty%2Fsamba.git s3:utils: let net_update_dns_internal() use c->opt_host to force a specific DC This means the server for dns updates can be provided by the admin. Pair-Programmed-With: Volker Lendecke Signed-off-by: Stefan Metzmacher Signed-off-by: Volker Lendecke --- diff --git a/source3/utils/net_ads_join_dns.c b/source3/utils/net_ads_join_dns.c index aaa0ca9885e..7b0bd644acd 100644 --- a/source3/utils/net_ads_join_dns.c +++ b/source3/utils/net_ads_join_dns.c @@ -45,6 +45,7 @@ static NTSTATUS net_update_dns_internal(struct net_context *c, int num_addrs, bool remove_host) { struct dns_rr_ns *nameservers = NULL; + struct dns_rr_ns _nameserver = {}; size_t ns_count = 0, i; NTSTATUS status = NT_STATUS_UNSUCCESSFUL; DNS_ERROR dns_err; @@ -65,6 +66,19 @@ static NTSTATUS net_update_dns_internal(struct net_context *c, } dnsdomain++; + if (c->opt_host != NULL) { + /* + * _nameserver.ss is not used + * otherwise we would need + * ads_dns_lookup_a and + * ads_dns_lookup_aaaa here. + */ + _nameserver.hostname = c->opt_host; + nameservers = &_nameserver; + ns_count = 1; + goto do_update; + } + status = ads_dns_lookup_ns(ctx, dnsdomain, &nameservers, @@ -127,6 +141,7 @@ static NTSTATUS net_update_dns_internal(struct net_context *c, } +do_update: for (i=0; i < ns_count; i++) { uint32_t flags = DNS_UPDATE_SIGNED |