From 6af3a5f54d650eaa673a19c3d6f242dee40610b5 Mon Sep 17 00:00:00 2001 From: Greg Hudson Date: Thu, 30 Apr 2009 17:49:28 +0000 Subject: [PATCH] In krb5_kt_resolve, ensure that the output parameter is set to NULL on failure even if the underlying resolver doesn't do that properly. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@22297 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/krb5/keytab/ktbase.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/lib/krb5/keytab/ktbase.c b/src/lib/krb5/keytab/ktbase.c index a764cc593..b99bee403 100644 --- a/src/lib/krb5/keytab/ktbase.c +++ b/src/lib/krb5/keytab/ktbase.c @@ -166,11 +166,13 @@ krb5_kt_resolve (krb5_context context, const char *name, krb5_keytab *ktid) unsigned int pfxlen; const char *cp, *resid; krb5_error_code err = 0; - + krb5_keytab id; + + *ktid = NULL; + cp = strchr (name, ':'); - if (!cp) { - return (*krb5_kt_dfl_ops.resolve)(context, name, ktid); - } + if (!cp) + return (*krb5_kt_dfl_ops.resolve)(context, name, ktid); pfxlen = cp - name; @@ -209,7 +211,9 @@ krb5_kt_resolve (krb5_context context, const char *name, krb5_keytab *ktid) k5_mutex_unlock(&kt_typehead_lock); for (; tlist; tlist = tlist->next) { if (strcmp (tlist->ops->prefix, pfx) == 0) { - err = (*tlist->ops->resolve)(context, resid, ktid); + err = (*tlist->ops->resolve)(context, resid, &id); + if (!err) + *ktid = id; goto cleanup; } } -- 2.26.2