1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

s3:libnet: Use lp_dns_hostname() in libnet_join.c

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Andreas Schneider 2024-04-04 11:24:13 +02:00 committed by Andrew Bartlett
parent 84989f2bf4
commit 0e96092c18

View File

@ -491,6 +491,7 @@ static ADS_STATUS libnet_join_set_machine_spn(TALLOC_CTX *mem_ctx,
char *spn = NULL;
const char **netbios_aliases = NULL;
const char **addl_hostnames = NULL;
const char *dns_hostname = NULL;
/* Find our DN */
@ -547,6 +548,27 @@ static ADS_STATUS libnet_join_set_machine_spn(TALLOC_CTX *mem_ctx,
goto done;
}
/*
* Register dns_hostname if needed, add_uniq_spn() will avoid
* duplicates.
*/
dns_hostname = lp_dns_hostname();
if (dns_hostname == NULL) {
status = ADS_ERROR_LDAP(LDAP_NO_MEMORY);
goto done;
}
spn = talloc_asprintf(frame, "HOST/%s", dns_hostname);
if (spn == NULL) {
status = ADS_ERROR_LDAP(LDAP_NO_MEMORY);
goto done;
}
status = add_uniq_spn(frame, spn, &spn_array, &num_spns);
if (!ADS_ERR_OK(status)) {
goto done;
}
for (netbios_aliases = lp_netbios_aliases();
netbios_aliases != NULL && *netbios_aliases != NULL;
netbios_aliases++) {