From bc46f2ed8cc1d8d66608f7f096f9732b8f461f16 Mon Sep 17 00:00:00 2001 From: "Jacques A. Vidrine" Date: Sun, 16 Jun 2002 15:13:25 +0000 Subject: [PATCH] Bug fix: the default credentials cache was not being used if a client name was specified. git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@11038 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/kadm5/init_c.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/lib/kadm5/init_c.c b/lib/kadm5/init_c.c index 93b165164..584d03501 100644 --- a/lib/kadm5/init_c.c +++ b/lib/kadm5/init_c.c @@ -262,10 +262,23 @@ get_cred_cache(krb5_context context, } } } - - if(client == NULL) + + if (client != NULL) { + /* A client was specified by the caller. */ + if (default_client != NULL) { + krb5_free_principal(context, default_client); + default_client = NULL; + } + } + else if (default_client != NULL) + /* No client was specified by the caller, but we have a + * client from the default credentials cache. + */ client = default_client; - if(client == NULL) { + else { + /* No client was specified by the caller and we cannot determine + * the client from a credentials cache. + */ const char *user; user = get_default_username (); @@ -276,10 +289,6 @@ get_cred_cache(krb5_context context, NULL, user, "admin", NULL); if(ret) return ret; - } - if(client != default_client) { - krb5_free_principal(context, default_client); - default_client = NULL; if (id != NULL) { krb5_cc_close(context, id); id = NULL; @@ -288,7 +297,6 @@ get_cred_cache(krb5_context context, } else if(ccache != NULL) id = ccache; - if(id && (default_client == NULL || krb5_principal_compare(context, client, default_client))) { ret = get_kadm_ticket(context, id, client, server_name);