summaryrefslogtreecommitdiffstats
path: root/source3/libnet/libnet_join.c
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2013-11-06 18:21:32 +0100
committerAndreas Schneider <asn@cryptomilk.org>2013-11-12 16:39:03 +0100
commit25be92b92567d962fa66261f565d3a8116f97e30 (patch)
treeef6f7c64aaaaa411f76f507d761e34d969f1cd1d /source3/libnet/libnet_join.c
parent0dd512eead6dc999511e9e21f5304a224653db85 (diff)
downloadsamba-25be92b92567d962fa66261f565d3a8116f97e30.tar.gz
samba-25be92b92567d962fa66261f565d3a8116f97e30.tar.xz
samba-25be92b92567d962fa66261f565d3a8116f97e30.zip
s3-libnetjoin: Fix Bug #10262: use upper-case realm when composing default upn.
In case we are about to generate a keytab during the join make sure the default upn we create is usable with kinit -k. BUG: https://bugzilla.samba.org/show_bug.cgi?id=10262 Guenther Signed-off-by: Günther Deschner <gd@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Tue Nov 12 16:39:03 CET 2013 on sn-devel-104
Diffstat (limited to 'source3/libnet/libnet_join.c')
-rw-r--r--source3/libnet/libnet_join.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c
index 2dcb920aa1..b84fcd6aa8 100644
--- a/source3/libnet/libnet_join.c
+++ b/source3/libnet/libnet_join.c
@@ -449,10 +449,25 @@ static ADS_STATUS libnet_join_set_machine_upn(TALLOC_CTX *mem_ctx,
}
if (!r->in.upn) {
+ char *realm = r->out.dns_domain_name;
+
+ /* in case we are about to generate a keytab during the join
+ * make sure the default upn we create is usable with kinit -k.
+ * gd */
+
+ if (USE_KERBEROS_KEYTAB) {
+ realm = talloc_strdup_upper(mem_ctx,
+ r->out.dns_domain_name);
+ }
+
+ if (!realm) {
+ return ADS_ERROR(LDAP_NO_MEMORY);
+ }
+
r->in.upn = talloc_asprintf(mem_ctx,
"host/%s@%s",
r->in.machine_name,
- r->out.dns_domain_name);
+ realm);
if (!r->in.upn) {
return ADS_ERROR(LDAP_NO_MEMORY);
}