From patchwork Thu Aug 7 11:47:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Dickson X-Patchwork-Id: 4690781 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E77C49F37E for ; Thu, 7 Aug 2014 11:47:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F399A2010E for ; Thu, 7 Aug 2014 11:47:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1766820103 for ; Thu, 7 Aug 2014 11:47:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757345AbaHGLrV (ORCPT ); Thu, 7 Aug 2014 07:47:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39996 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757335AbaHGLrU (ORCPT ); Thu, 7 Aug 2014 07:47:20 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s77BlE6W024748 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 7 Aug 2014 07:47:15 -0400 Received: from smallhat.boston.devel.redhat.com (vpn-56-74.rdu2.redhat.com [10.10.56.74]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s77BlDG2015238; Thu, 7 Aug 2014 07:47:13 -0400 Message-ID: <53E36741.2010907@RedHat.com> Date: Thu, 07 Aug 2014 07:47:13 -0400 From: Steve Dickson User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.7.0 MIME-Version: 1.0 To: Jurjen Bokma , linux-nfs@vger.kernel.org Subject: Re: Patch: select non-conventional principal in gssd References: <53E242E9.1050106@rug.nl> In-Reply-To: <53E242E9.1050106@rug.nl> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 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.6 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 On 08/06/2014 10:59 AM, Jurjen Bokma wrote: > HiAll, > > I have a patch to utils/gssd/krb5_util.c that enables kerberized NFS > mounts to succeed even if the principal is not $. > > It works by reading another principal name from the [appdefaults] > section of krb5.conf: > > [appdefaults] > nfs = { > ad_principal_name = 129.125.39.115$ > } > > Patch is attached. Would you please incorporate it in the source if you > find it useful? > Sorry if I'm asking in the wrong place. A couple things.... One please inline your patche in your email, not attach them as suggested in https://www.kernel.org/doc/Documentation/SubmittingPatches Inlining makes it easier to review... + } retval = get_full_hostname(myhostname, myhostname, sizeof(myhostname)); if (retval) --- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- utils/gssd/krb5_util.c.orig 2014-08-06 10:54:18.806414170 +0200 +++ utils/gssd/krb5_util.c 2014-08-06 11:01:21.016320365 +0200 @@ -801,7 +801,8 @@ char *k5err = NULL; int tried_all = 0, tried_default = 0; krb5_principal princ; - + const char *notsetstr = "not set"; + char *adhostoverride; /* Get full target hostname */ retval = get_full_hostname(tgtname, targethostname, @@ -818,11 +819,18 @@ } /* Compute the active directory machine name HOST$ */ - strcpy(myhostad, myhostname); - for (i = 0; myhostad[i] != 0; ++i) - myhostad[i] = toupper(myhostad[i]); - myhostad[i] = '$'; - myhostad[i+1] = 0; + krb5_appdefault_string(context, "nfs", NULL, "ad_principal_name", notsetstr, &adhostoverride); Secondly, where does them memory for adhostoverride get freed?? steved. + if (strcmp(adhostoverride, notsetstr) != 0) { + printerr (0, "AD host string overridden with \"%s\" from appdefaults\n", adhostoverride); + /* No overflow: Windows cannot handle strings longer than 19 chars */ + strcpy(myhostad, adhostoverride); + } else { + strcpy(myhostad, myhostname); + for (i = 0; myhostad[i] != 0; ++i) + myhostad[i] = toupper(myhostad[i]); + myhostad[i] = '$'; + myhostad[i+1] = 0;