From: Greg Hudson Date: Thu, 30 Apr 2009 17:49:28 +0000 (+0000) Subject: In krb5_kt_resolve, ensure that the output parameter is set to NULL on X-Git-Tag: krb5-1.8-alpha1~510 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=6af3a5f54d650eaa673a19c3d6f242dee40610b5;p=krb5.git 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 --- 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; } }