linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Maximilian Wilhelm <max@rfc2324.org>
To: linux-nfs@vger.kernel.org
Cc: Frederik Moellers <frederik.moellers@upb.de>
Subject: Re: [PATCH] Fix handling of preferred_realm command line option
Date: Fri, 24 May 2013 15:48:58 +0200	[thread overview]
Message-ID: <20130524134858.GS20475@principal.rfc2324.org> (raw)
In-Reply-To: <20130524125424.GQ20475@principal.rfc2324.org>

[-- Attachment #1: Type: text/plain, Size: 541 bytes --]

Anno domini 2013 Maximilian Wilhelm scripsit:

Me again,

> (Please CC me in replies, I'm not on the list.)

> we found a problem in the gssd daemon when using the -R opton to
> specify a different preferred realm than the one used on the system.
> It seems the preferred_realm variable set in the gssd.c file is not
> used at all when searching for keytab entries / principal.

> The simple patch attached fixes this problem.

I felt the urge to update the comment, too :)

Best regards
Max
-- 
Friends are relatives you make for yourself.

[-- Attachment #2: gssd_fix_preferred_realm.patch --]
[-- Type: text/x-diff, Size: 1347 bytes --]

commit 722bd62d1e6a9d38db57e919d914a371e67d804d
Author: Maximilian Wilhelm <max@rfc2324.org>
Date:   Fri May 24 14:46:41 2013 +0200

    Fix handling of preferred realm command line option.
    
      The current implementation ignores any preferred realm specified on the
      command line. Fix this behaviour and make sure the preferred realm is
      used as first realm when trying to acquire a keytab entry.
    
    Signed-off-by: Maximilian Wilhelm <max@rfc2324.org>
    Signed-off-by: Frederik Moellers <frederik.moellers@upb.de>

diff --git a/utils/gssd/krb5_util.c b/utils/gssd/krb5_util.c
index 6275dd8..fb706a8 100644
--- a/utils/gssd/krb5_util.c
+++ b/utils/gssd/krb5_util.c
@@ -852,11 +852,18 @@ find_keytab_entry(krb5_context context, krb5_keytab kt, const char *tgtname,
 	}
 
 	/*
-	 * Try the "appropriate" realm first, and if nothing found for that
-	 * realm, try the default realm (if it hasn't already been tried).
+	 * Make sure the preferred_realm (which may have been explicitly set
+	 * on the command line, is tried first. If nothing is found go on with
+	 * the host and local default realm (if that hasn't already been tried).
 	 */
 	i = 0;
 	realm = realmnames[i];
+
+	if (strcmp (realm, preferred_realm) != 0) {
+		realm = preferred_realm;
+		i = -1;
+	}
+
 	while (1) {
 		if (realm == NULL) {
 			tried_all = 1;

      reply	other threads:[~2013-05-24 13:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-24 12:54 [PATCH] Fix handling of preferred_realm command line option Maximilian Wilhelm
2013-05-24 13:48 ` Maximilian Wilhelm [this message]

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=20130524134858.GS20475@principal.rfc2324.org \
    --to=max@rfc2324.org \
    --cc=frederik.moellers@upb.de \
    --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).