All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simo Sorce <simo@redhat.com>
To: Steve Dickson <steved@redhat.com>
Cc: linux-nfs <linux-nfs@vger.kernel.org>
Subject: [PATCH] Fix windows hostname calculation
Date: Thu, 20 Feb 2014 09:30:48 -0500	[thread overview]
Message-ID: <1392906648.22754.213.camel@willson.li.ssimo.org> (raw)

>From 026c489ac7019a91951b37240f438329de1d615c Mon Sep 17 00:00:00 2001
From: Simo Sorce <simo@redhat.com>
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.

Signed-off-by: Simo Sorce <simo@redhat.com>
---
 utils/gssd/krb5_util.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/utils/gssd/krb5_util.c b/utils/gssd/krb5_util.c
index
208c72bc072bceecc81f591887603e274dc35d9b..4b57141b4e17643ef9b56aa13639354860009db6 100644
--- a/utils/gssd/krb5_util.c
+++ b/utils/gssd/krb5_util.c
@@ -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;
 
-- 
1.8.5.3


-- 
Simo Sorce * Red Hat, Inc * New York


             reply	other threads:[~2014-02-20 14:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-20 14:30 Simo Sorce [this message]
2014-03-10 20:26 ` [PATCH] Fix windows hostname calculation Steve Dickson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1392906648.22754.213.camel@willson.li.ssimo.org \
    --to=simo@redhat.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=steved@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.