From 5d676c4509de8914be6f4cf423a84add77c0d2e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Love=20H=C3=B6rnquist=20=C3=85strand?= Date: Mon, 10 Apr 2006 07:55:22 +0000 Subject: [PATCH] (_kadm5_c_get_cred_cache): handle ccache case better in case no client name was passed in. Coverity, NetBSD CID#919 git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@17029 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/kadm5/init_c.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/kadm5/init_c.c b/lib/kadm5/init_c.c index b3045532a..6f44ad7a4 100644 --- a/lib/kadm5/init_c.c +++ b/lib/kadm5/init_c.c @@ -314,8 +314,13 @@ _kadm5_c_get_cred_cache(krb5_context context, id = NULL; } } - } else if(ccache != NULL) + } else if(ccache != NULL) { id = ccache; + ret = krb5_cc_get_principal(context, id, &client); + if(ret) + return ret; + } + if(id && (default_client == NULL || krb5_principal_compare(context, client, default_client))) { @@ -332,7 +337,7 @@ _kadm5_c_get_cred_cache(krb5_context context, return -1; } /* get creds via AS request */ - if(id) + if(id && (id != ccache)) krb5_cc_close(context, id); if (client != default_client) krb5_free_principal(context, default_client);