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
(cherry picked from commit
062dc07e9b9c8e260548d0bca4d02819bdc60326)
Autobuild-User(v4-21-test): Jule Anger <janger@samba.org>
Autobuild-Date(v4-21-test): Wed Feb 12 10:37:56 UTC 2025 on atb-devel-224
* 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;