From patchwork Thu Feb 20 14:30:48 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simo Sorce X-Patchwork-Id: 3687191 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6643BBF13A for ; Thu, 20 Feb 2014 14:31:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9774520158 for ; Thu, 20 Feb 2014 14:31:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9E10A20149 for ; Thu, 20 Feb 2014 14:30:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754714AbaBTOa6 (ORCPT ); Thu, 20 Feb 2014 09:30:58 -0500 Received: from mx1.redhat.com ([209.132.183.28]:26337 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752700AbaBTOa6 (ORCPT ); Thu, 20 Feb 2014 09:30:58 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s1KEUpZR002104 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 20 Feb 2014 09:30:56 -0500 Received: from [10.3.113.6] ([10.3.113.6]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s1KEUniA012818; Thu, 20 Feb 2014 09:30:49 -0500 Subject: [PATCH] Fix windows hostname calculation From: Simo Sorce To: Steve Dickson Cc: linux-nfs Organization: Red Hat, Inc. Date: Thu, 20 Feb 2014 09:30:48 -0500 Message-ID: <1392906648.22754.213.camel@willson.li.ssimo.org> Mime-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From 026c489ac7019a91951b37240f438329de1d615c Mon Sep 17 00:00:00 2001 From: Simo Sorce 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 --- 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;