linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steve Dickson <SteveD@redhat.com>
To: Jurjen Bokma <j.bokma@rug.nl>, linux-nfs@vger.kernel.org
Subject: Re: Patch: select non-conventional principal in gssd
Date: Thu, 07 Aug 2014 07:47:13 -0400	[thread overview]
Message-ID: <53E36741.2010907@RedHat.com> (raw)
In-Reply-To: <53E242E9.1050106@rug.nl>



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 <HOSTNAME>$.
> 
> 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... 


--- 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;
+	}
 
 	retval = get_full_hostname(myhostname, myhostname, sizeof(myhostname));
 	if (retval)

  reply	other threads:[~2014-08-07 11:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-06 14:59 Patch: select non-conventional principal in gssd Jurjen Bokma
2014-08-07 11:47 ` Steve Dickson [this message]
2014-08-07 13:01   ` Jurjen Bokma
2014-08-07 13:31     ` Steve Dickson
  -- strict thread matches above, loose matches on Subject: below --
2014-08-06 18:42 Jurjen Bokma

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=53E36741.2010907@RedHat.com \
    --to=steved@redhat.com \
    --cc=j.bokma@rug.nl \
    --cc=linux-nfs@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).