From de239fe22fba7c3a4632466366602aa4ce977587 Mon Sep 17 00:00:00 2001 From: Johan Danielsson Date: Mon, 25 Mar 2002 13:17:38 +0000 Subject: [PATCH] (get_cred_cache): when getting the default_client from the cred cache, make sure the instance part is "admin"; this should require fewer uses of -p git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@10894 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/kadm5/init_c.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lib/kadm5/init_c.c b/lib/kadm5/init_c.c index d92464192..93b165164 100644 --- a/lib/kadm5/init_c.c +++ b/lib/kadm5/init_c.c @@ -240,6 +240,26 @@ get_cred_cache(krb5_context context, if(ret) { krb5_cc_close(context, id); id = NULL; + } else { + const char *name, *inst; + krb5_principal tmp; + name = krb5_principal_get_comp_string(context, + default_client, 0); + inst = krb5_principal_get_comp_string(context, + default_client, 1); + if(inst == NULL || strcmp(inst, "admin") != 0) { + ret = krb5_make_principal(context, &tmp, NULL, + name, "admin", NULL); + if(ret != 0) { + krb5_free_principal(context, default_client); + krb5_cc_close(context, id); + return ret; + } + krb5_free_principal(context, default_client); + default_client = tmp; + krb5_cc_close(context, id); + id = NULL; + } } }