From: Andreas Schneider Date: Wed, 6 Mar 2024 14:53:17 +0000 (+0100) Subject: s3:utils: Use lp_dns_hostname() for 'net' dns updates X-Git-Tag: tdb-1.4.11~600 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b93fef8e90d3797dad5ce120831fcdfccd6cd30c;p=thirdparty%2Fsamba.git s3:utils: Use lp_dns_hostname() for 'net' dns updates name_to_fqdn() requires /etc/hosts to be set up in a special way to find out the fqdn for dns updates. They are not set up by default and the DNS update fails. Normally the fqdn is just . and we should just use that. However if it is different, you can set it to the special value in the smb.conf now. Signed-off-by: Andreas Schneider Reviewed-by: Andrew Bartlett --- diff --git a/source3/utils/net_ads_join_dns.c b/source3/utils/net_ads_join_dns.c index ac8ffc64998..88287963dcf 100644 --- a/source3/utils/net_ads_join_dns.c +++ b/source3/utils/net_ads_join_dns.c @@ -205,7 +205,11 @@ NTSTATUS net_update_dns_ext(struct net_context *c, if (hostname) { fstrcpy(machine_name, hostname); } else { - name_to_fqdn( machine_name, lp_netbios_name() ); + const char *dns_hostname = lp_dns_hostname(); + if (dns_hostname == NULL) { + return NT_STATUS_NO_MEMORY; + } + fstrcpy(machine_name, lp_dns_hostname()); } if (!strlower_m( machine_name )) { return NT_STATUS_INVALID_PARAMETER;