diff mbox

: gssd: Fix preferred_realm option handling

Message ID 20130611093403.GB27345@principal.rfc2324.org (mailing list archive)
State New, archived
Headers show

Commit Message

Maximilian Wilhelm June 11, 2013, 9:34 a.m. UTC
Hi,

the gssd currently ignores any preferred realm given via the -R
command line option.

The attached patch fixes that behaviour and makes sure the
preferrred_realm is used first when searching for a valid principal
for mount authentication.

I would be happy if you would apply this. This would close bug #235 in
bugzilla.

Thanks
Max

Comments

Jim Rees June 11, 2013, 11:41 a.m. UTC | #1
Maximilian Wilhelm wrote:

  +	 * 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).

You're missing a close paren there somewhere.
--
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
Maximilian Wilhelm June 17, 2013, 5:02 p.m. UTC | #2
Anno domini 2013 Jim Rees scripsit:

> Maximilian Wilhelm wrote:

>   +	 * 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).

> You're missing a close paren there somewhere.

Indeed. The first '(' should have been a ','.

Anyone willing to apply this?

Thanks
Max
J. Bruce Fields June 18, 2013, 5:14 p.m. UTC | #3
On Mon, Jun 17, 2013 at 07:02:47PM +0200, Maximilian Wilhelm wrote:
> Anno domini 2013 Jim Rees scripsit:
> 
> > Maximilian Wilhelm wrote:
> 
> >   +	 * 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).
> 
> > You're missing a close paren there somewhere.
> 
> Indeed. The first '(' should have been a ','.
> 
> Anyone willing to apply this?

Note nfs-utils patches should go to steved@redhat.com, cc'd to this
list.

But also note this is the week of the Ann Arbor bakeathon so many of us
will be less responsive this week.

--b.
--
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
Steve Dickson June 24, 2013, 5 p.m. UTC | #4
On 17/06/13 13:02, Maximilian Wilhelm wrote:
> Anno domini 2013 Jim Rees scripsit:
> 
>> Maximilian Wilhelm wrote:
> 
>>   +	 * 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).
> 
>> You're missing a close paren there somewhere.
> 
> Indeed. The first '(' should have been a ','.
> 
> Anyone willing to apply this?
Its on my TODO list... and I'll fix the comment up...

steved.

> 
> Thanks
> Max
> 
--
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
diff mbox

Patch

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;