]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:utils: Use lp_dns_hostname() for 'net' dns updates
authorAndreas Schneider <asn@samba.org>
Wed, 6 Mar 2024 14:53:17 +0000 (15:53 +0100)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 22 May 2024 20:33:36 +0000 (20:33 +0000)
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 <lp_netbios_name>.<realm>
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 <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source3/utils/net_ads_join_dns.c

index ac8ffc649986bc44badf9a7ab26cd10fda544207..88287963dcfdb956065c4d14bd73c26d0e39a201 100644 (file)
@@ -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;