summaryrefslogtreecommitdiff
path: root/source3/libnet
diff options
context:
space:
mode:
authorIsaac Boukris <iboukris@gmail.com>2019-09-13 10:56:10 +0300
committerRalph Boehme <slow@samba.org>2019-10-25 10:43:08 +0000
commit2669cecc51f8f7d6675b4dac9b345b3c5a7fc879 (patch)
tree08cddee23ad1f69d8acc97c7a1b08090035e80f0 /source3/libnet
parentdb7560ff0fb861552406bb4c422cff55c82f58bf (diff)
downloadsamba-2669cecc51f8f7d6675b4dac9b345b3c5a7fc879.tar.gz
libnet_join: add SPNs for additional-dns-hostnames entries
and set msDS-AdditionalDnsHostName to the specified list. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14116 Signed-off-by: Isaac Boukris <iboukris@redhat.com> Reviewed-by: Ralph Boehme <slow@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org> Autobuild-User(master): Ralph Böhme <slow@samba.org> Autobuild-Date(master): Fri Oct 25 10:43:08 UTC 2019 on sn-devel-184
Diffstat (limited to 'source3/libnet')
-rw-r--r--source3/libnet/libnet_join.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c
index a1d8a25bbc2..eb8e0ea17f7 100644
--- a/source3/libnet/libnet_join.c
+++ b/source3/libnet/libnet_join.c
@@ -511,6 +511,7 @@ static ADS_STATUS libnet_join_set_machine_spn(TALLOC_CTX *mem_ctx,
size_t num_spns = 0;
char *spn = NULL;
const char **netbios_aliases = NULL;
+ const char **addl_hostnames = NULL;
/* Find our DN */
@@ -602,6 +603,22 @@ static ADS_STATUS libnet_join_set_machine_spn(TALLOC_CTX *mem_ctx,
}
}
+ for (addl_hostnames = lp_additional_dns_hostnames();
+ addl_hostnames != NULL && *addl_hostnames != NULL;
+ addl_hostnames++) {
+
+ spn = talloc_asprintf(frame, "HOST/%s", *addl_hostnames);
+ 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;
+ }
+ }
+
/* make sure to NULL terminate the array */
spn_array = talloc_realloc(frame, spn_array, const char *, num_spns + 1);
if (spn_array == NULL) {
@@ -629,6 +646,16 @@ static ADS_STATUS libnet_join_set_machine_spn(TALLOC_CTX *mem_ctx,
goto done;
}
+ addl_hostnames = lp_additional_dns_hostnames();
+ if (addl_hostnames != NULL && *addl_hostnames != NULL) {
+ status = ads_mod_strlist(mem_ctx, &mods,
+ "msDS-AdditionalDnsHostName",
+ addl_hostnames);
+ if (!ADS_ERR_OK(status)) {
+ goto done;
+ }
+ }
+
status = ads_gen_mod(r->in.ads, r->out.dn, mods);
done: