diff options
-rw-r--r-- | utils/gssd/krb5_util.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/utils/gssd/krb5_util.c b/utils/gssd/krb5_util.c index 9ef80f0..abebdcd 100644 --- a/utils/gssd/krb5_util.c +++ b/utils/gssd/krb5_util.c @@ -852,11 +852,19 @@ 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; + /* resetting the realmnames index */ + i = -1; + } + while (1) { if (realm == NULL) { tried_all = 1; |