From e9a16b0d15a2fb5ed2fa294a9cc49919f684a033 Mon Sep 17 00:00:00 2001 From: Alexandra Ellwood Date: Tue, 18 Jul 2006 20:11:39 +0000 Subject: [PATCH] acquire_cred(): Fixed KLL support to try the default ccache first if it is set. ticket: 4024 status: open git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@18340 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/gssapi/krb5/acquire_cred.c | 32 ++++++++++++++++++------------ 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/src/lib/gssapi/krb5/acquire_cred.c b/src/lib/gssapi/krb5/acquire_cred.c index 09e0dc8a2..982504cfc 100644 --- a/src/lib/gssapi/krb5/acquire_cred.c +++ b/src/lib/gssapi/krb5/acquire_cred.c @@ -233,30 +233,36 @@ acquire_init_cred(context, minor_status, desired_name, output_princ, cred) #if defined(USE_LOGIN_LIBRARY) || defined(USE_LEASH) if (desired_name != NULL) { #if defined(USE_LOGIN_LIBRARY) + KLStatus err = klNoErr; char *ccache_name = NULL; KLPrincipal kl_desired_princ = NULL; - if ((code = __KLCreatePrincipalFromKerberos5Principal ((krb5_principal) desired_name, - &kl_desired_princ))) { - *minor_status = code; - return(GSS_S_CRED_UNAVAIL); + err = __KLCreatePrincipalFromKerberos5Principal ((krb5_principal) desired_name, + &kl_desired_princ); + + if (!err) { + char *default_name = krb5_cc_default_name (context); + + if (default_name) { + err = __KLAcquireInitialTicketsForCache (default_name, kl_desired_princ, + NULL, NULL, &ccache_name); + } else { + err = KLAcquireInitialTickets (kl_desired_princ, NULL, NULL, &ccache_name); + } } - if ((code = KLAcquireInitialTickets (kl_desired_princ, NULL, NULL, &ccache_name))) { - KLDisposePrincipal (kl_desired_princ); - *minor_status = code; - return(GSS_S_CRED_UNAVAIL); + if (!err) { + err = krb5_cc_resolve (context, ccache_name, &ccache); } - if ((code = krb5_cc_resolve (context, ccache_name, &ccache))) { - KLDisposeString (ccache_name); - KLDisposePrincipal (kl_desired_princ); - *minor_status = code; + if (err) { + *minor_status = err; return(GSS_S_CRED_UNAVAIL); } - + if (kl_desired_princ != NULL) { KLDisposePrincipal (kl_desired_princ); } if (ccache_name != NULL) { KLDisposeString (ccache_name); } + #elif defined(USE_LEASH) if ( hLeashDLL == INVALID_HANDLE_VALUE ) { hLeashDLL = LoadLibrary("leashw32.dll"); -- 2.26.2