From 58a7d59b47e263f389e2cfbe002c0ae54c022950 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Love=20H=C3=B6rnquist=20=C3=85strand?= Date: Mon, 3 Dec 2007 21:20:02 +0000 Subject: [PATCH] Put back code that was needed, move gen_new into new_unique. git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@22113 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/krb5/cache.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/lib/krb5/cache.c b/lib/krb5/cache.c index f140b0520..9500c582b 100644 --- a/lib/krb5/cache.c +++ b/lib/krb5/cache.c @@ -185,12 +185,7 @@ krb5_cc_gen_new(krb5_context context, const krb5_cc_ops *ops, krb5_ccache *id) { - krb5_error_code ret; - - ret = _krb5_cc_allocate(context, ops, id); - if (ret) - return ret; - return (*id)->ops->gen_new(context, id); + return krb5_cc_new_unique(context, ops->prefix, NULL, id); } /** @@ -210,7 +205,21 @@ krb5_cc_new_unique(krb5_context context, const char *type, const char *hint, krb5_ccache *id) { const krb5_cc_ops *ops = KRB5_DEFAULT_CCTYPE; - return krb5_cc_gen_new(context, ops, id); + krb5_error_code ret; + + if (type) { + ops = krb5_cc_get_prefix_ops(context, type); + if (ops == NULL) { + krb5_set_error_string(context, + "Credential cache type %s is unknown", type); + return KRB5_CC_UNKNOWN_TYPE; + } + } + + ret = _krb5_cc_allocate(context, ops, id); + if (ret) + return ret; + return (*id)->ops->gen_new(context, id); } /**