From 57ca7c37e90acbcd8da6d215dc4f3c0edd7a88e5 Mon Sep 17 00:00:00 2001 From: Luke Howard Date: Sat, 17 Sep 2011 08:10:21 +1000 Subject: [PATCH] more cleanup of TLD --- moonshot/mech_eap/display_status.c | 2 +- moonshot/mech_eap/util_krb.c | 9 +++++++-- moonshot/mech_eap/util_tld.c | 8 +++++++- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/moonshot/mech_eap/display_status.c b/moonshot/mech_eap/display_status.c index 6eac550..fc0d1ab 100644 --- a/moonshot/mech_eap/display_status.c +++ b/moonshot/mech_eap/display_status.c @@ -64,7 +64,7 @@ gssEapDestroyStatusInfo(struct gss_eap_status_info *p) static void saveStatusInfoNoCopy(OM_uint32 minor, char *message) { - struct gss_eap_status_info **next = NULL, *p=NULL; + struct gss_eap_status_info **next = NULL, *p = NULL; struct gss_eap_thread_local_data *tld = gssEapGetThreadLocalData(); if (tld != NULL) { diff --git a/moonshot/mech_eap/util_krb.c b/moonshot/mech_eap/util_krb.c index 06da80e..8775c83 100644 --- a/moonshot/mech_eap/util_krb.c +++ b/moonshot/mech_eap/util_krb.c @@ -88,11 +88,16 @@ gssEapKerberosInit(OM_uint32 *minor, krb5_context *context) if (tld != NULL) { if (tld->krbContext == NULL) { *minor = initKrbContext(&tld->krbContext); - if (*minor == 0) - *context = tld->krbContext; + if (*minor != 0) + tld->krbContext = NULL; } + *context = tld->krbContext; + } else { + *minor = GSSEAP_GET_LAST_ERROR(); } + GSSEAP_ASSERT(*context != NULL || *minor != 0); + return (*minor == 0) ? GSS_S_COMPLETE : GSS_S_FAILURE; } diff --git a/moonshot/mech_eap/util_tld.c b/moonshot/mech_eap/util_tld.c index a30f5f3..10e3359 100644 --- a/moonshot/mech_eap/util_tld.c +++ b/moonshot/mech_eap/util_tld.c @@ -62,7 +62,13 @@ static DWORD tlsIndex; struct gss_eap_thread_local_data * gssEapGetThreadLocalData(void) { - return TlsGetValue(tlsIndex); + struct gss_eap_thread_local_data *tld; + + tld = TlsGetValue(tlsIndex); + + GSSEAP_ASSERT(tld != NULL); + + return tld; } BOOL WINAPI -- 2.1.4