Skip to contentSkip to conversation

Fix windows hostname calculation

PATCH In review Simo Sorce 2 participants 2 messages Feb 20, 2014 – Mar 10, 2014

Subsystems (2)
lore
Share & tools
lore

Simo Sorce

author
#0 lore raw

PATCH 1/1 Fix windows hostname calculation

Quoted 1 line

From 026c489ac7019a91951b37240f438329de1d615c Mon Sep 17 00:00:00 2001

From: Simo Sorce <[email protected]>
Date: Thu, 20 Feb 2014 09:25:06 -0500
Subject: [PATCH] Drop full domain when constructing the Ad hostname.

When trying to use the special MS Windows hostanme we need to stop at the first '.' if we got a FQDN from gethostname()
Tee HOST$@REALM form in fact uses the AD samAccountName attribute to represent 'HOST', and that attribute is always the host's shortname. Characters like '.' are actually illegal for a shortname in AD.

---
 utils/gssd/krb5_util.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
utils/gssd/krb5_util.c +0 -0

index 208c72bc072bceecc81f591887603e274dc35d9b..4b57141b4e17643ef9b56aa13639354860009db6 100644

utils/gssd/krb5_util.c +0 -0
@@ -819,8 +819,10 @@ find_keytab_entry(krb5_context context, krb5_keytab

kt, const char *tgtname,

/* Compute the active directory machine name HOST$ */ strcpy(myhostad, myhostname);
- for (i = 0; myhostad[i] != 0; ++i)
+ for (i = 0; myhostad[i] != 0; ++i) {
+ if (myhostad[i] == '.') break;
myhostad[i] = toupper(myhostad[i]);
+ }
myhostad[i] = '$';
myhostad[i+1] = 0;

Signature · 5 lines
1.8.5.3


-- 
Simo Sorce * Red Hat, Inc * New York
#1 lore raw
Quoted 5 lines · Simo Sorce

From 026c489ac7019a91951b37240f438329de1d615c Mon Sep 17 00:00:00 2001
From: Simo Sorce <[email protected]>
Date: Thu, 20 Feb 2014 09:25:06 -0500
Subject: [PATCH] Drop full domain when constructing the Ad hostname.

Quoted 7 lines

When trying to use the special MS Windows hostanme we need to stop at the first '.' if we got a FQDN from gethostname()
Tee HOST$@REALM form in fact uses the AD samAccountName attribute to represent 'HOST', and that attribute is always the host's shortname. Characters like '.' are actually illegal for a shortname in AD.

Committed...

steved.

Quoted 23 lines
---
 utils/gssd/krb5_util.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
utils/gssd/krb5_util.c +0 -0

index 208c72bc072bceecc81f591887603e274dc35d9b..4b57141b4e17643ef9b56aa13639354860009db6 100644

utils/gssd/krb5_util.c +3 -1
@@ -819,8 +819,10 @@ find_keytab_entry(krb5_context context, krb5_keytab
 kt, const char *tgtname,
 
 	/* Compute the active directory machine name HOST$ */
 	strcpy(myhostad, myhostname);
-	for (i = 0; myhostad[i] != 0; ++i)
+	for (i = 0; myhostad[i] != 0; ++i) {
+		if (myhostad[i] == '.') break;
 		myhostad[i] = toupper(myhostad[i]);
+	}
 	myhostad[i] = '$';
 	myhostad[i+1] = 0;