]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3-libnet: avoid using lp_dns_hostname() in join code
authorGünther Deschner <gd@samba.org>
Tue, 14 Jan 2025 18:16:31 +0000 (19:16 +0100)
committerAndreas Schneider <asn@cryptomilk.org>
Thu, 30 Jan 2025 07:35:05 +0000 (07:35 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15777

This codepath is also used for provisiong non-local machines into AD
during offlinejoin operations. When creating accounts for non-local
machines we certainly need to be able to use arbitrary hostname other
than lp_netbios_name() (which is used internally by lp_dns_hostname()).
This partly reverts 0e96092c1895ecb41d4064111566b4ada71fe457.

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu Jan 30 07:35:05 UTC 2025 on atb-devel-224

source3/libnet/libnet_join.c

index 23c3d50f2f6fd59a20fd28334236878afb4f5bc7..5796c68e2e0c0f4265c73bc963b5ecf7685ca88d 100644 (file)
@@ -553,7 +553,14 @@ static ADS_STATUS libnet_join_set_machine_spn(TALLOC_CTX *mem_ctx,
         * Register dns_hostname if needed, add_uniq_spn() will avoid
         * duplicates.
         */
-       dns_hostname = lp_dns_hostname();
+       if (r->in.dnshostname != NULL) {
+               dns_hostname = talloc_strdup(frame, r->in.dnshostname);
+       } else {
+               dns_hostname = talloc_asprintf(frame,
+                                              "%s.%s",
+                                              r->in.machine_name,
+                                              r->out.dns_domain_name);
+       }
        if (dns_hostname == NULL) {
                status = ADS_ERROR_LDAP(LDAP_NO_MEMORY);
                goto done;