+2005-10-20 Alexandra Ellwood <lxs@mit.edu>, Jeffrey Altman <jaltman@mit.edu>
+
+ * acquire_cred.c (acquire_init_cred):
+ If a specific principal has been requested, attempt to acquire
+ tickets and set the ccache name in the context to the ccache
+ containing the tickets if obtained. (KFM/KFW)
+
2005-10-20 Jeffrey Altman <jaltman@mit.edu>
* gssapi_krb5.hin: add missing GSS_DLLIMP to exported symbols
#include <strings.h>
#endif
-#ifdef USE_LOGIN_LIBRARY
+#if defined(USE_LOGIN_LIBRARY)
#include <Kerberos/KerberosLoginPrivate.h>
+#elif defined(USE_LEASH)
+static void (*pLeash_AcquireInitialTicketsIfNeeded)(krb5_context,krb5_principal,char*,int) = NULL;
+static HANDLE hLeashDLL = INVALID_HANDLE_VALUE;
#endif
k5_mutex_t gssint_krb5_keytab_lock = K5_MUTEX_PARTIAL_INITIALIZER;
if (GSS_ERROR(kg_sync_ccache_name(context, minor_status)))
return(GSS_S_FAILURE);
-#ifdef USE_LOGIN_LIBRARY
+#if defined(USE_LOGIN_LIBRARY) || defined(USE_LEASH)
if (desired_name != NULL) {
+#if defined(USE_LOGIN_LIBRARY)
char *ccache_name = NULL;
KLPrincipal kl_desired_princ = NULL;
if (kl_desired_princ != NULL) { KLDisposePrincipal (kl_desired_princ); }
if (ccache_name != NULL) { KLDisposeString (ccache_name); }
-
- } else {
-#endif
- /* open the default credential cache */
+#elif defined(USE_LEASH)
+ if ( hLeashDLL == INVALID_HANDLE_VALUE ) {
+ hLeashDLL = LoadLibrary("leashw32.dll");
+ if ( hLeashDLL != INVALID_HANDLE_VALUE ) {
+ (FARPROC) pLeash_AcquireInitialTicketsIfNeeded =
+ GetProcAddress(hLeashDLL, "not_an_API_Leash_AcquireInitialTicketsIfNeeded");
+ }
+ }
+
+ if ( pLeash_AcquireInitialTicketsIfNeeded ) {
+ char ccname[256]="";
+ pLeash_AcquireInitialTicketsIfNeeded(context, (krb5_principal) desired_name, ccname, sizeof(ccname));
+ if (!ccname[0]) {
+ *minor_status = KRB5_CC_NOTFOUND;
+ return(GSS_S_CRED_UNAVAIL);
+ }
+
+ if ((code = krb5_cc_resolve (context, ccname, &ccache))) {
+ *minor_status = code;
+ return(GSS_S_CRED_UNAVAIL);
+ }
+ }
+#endif /* USE_LEASH */
+ } else
+#endif /* USE_LOGIN_LIBRARY || USE_LEASH */
+ {
+ /* open the default credential cache */
- if ((code = krb5int_cc_default(context, &ccache))) {
- *minor_status = code;
- return(GSS_S_CRED_UNAVAIL);
- }
-#ifdef USE_LOGIN_LIBRARY
+ if ((code = krb5int_cc_default(context, &ccache))) {
+ *minor_status = code;
+ return(GSS_S_CRED_UNAVAIL);
+ }
}
-#endif
/* turn off OPENCLOSE mode while extensive frobbing is going on */
#include "k5-int.h"
-#ifdef USE_LOGIN_LIBRARY
+#if defined(USE_LOGIN_LIBRARY)
#include "KerberosLoginPrivate.h"
-#else
-#ifdef USE_LEASH
-static void (*pLeash_AcquireInitialTicketsIfNeeded)(krb5_context,krb5_principal) = NULL;
+#elif defined(USE_LEASH)
+static void (*pLeash_AcquireInitialTicketsIfNeeded)(krb5_context,krb5_principal,char*,int) = NULL;
static HANDLE hLeashDLL = INVALID_HANDLE_VALUE;
#endif
-#endif
krb5_error_code KRB5_CALLCONV
krb5_cc_default(krb5_context context, krb5_ccache *ccache)
{
- krb5_error_code retval;
krb5_os_context os_ctx;
if (!context || context->magic != KV5M_CONTEXT)
}
#else
#ifdef USE_LEASH
-
if ( hLeashDLL == INVALID_HANDLE_VALUE ) {
hLeashDLL = LoadLibrary("leashw32.dll");
if ( hLeashDLL != INVALID_HANDLE_VALUE ) {
}
if ( pLeash_AcquireInitialTicketsIfNeeded ) {
- pLeash_AcquireInitialTicketsIfNeeded(context, NULL);
+ char ccname[256]="";
+ pLeash_AcquireInitialTicketsIfNeeded(context, NULL, ccname, sizeof(ccname));
+ if (ccname[0]) {
+ if (strcmp (krb5_cc_default_name (context),ccname) != 0) {
+ krb5_cc_set_default_name (context, ccname);
+ }
+ }
}
#endif
#endif