more cleanup of TLD
authorLuke Howard <lukeh@padl.com>
Fri, 16 Sep 2011 22:10:21 +0000 (08:10 +1000)
committerLuke Howard <lukeh@padl.com>
Sat, 17 Sep 2011 06:17:13 +0000 (16:17 +1000)
mech_eap/display_status.c
mech_eap/util_krb.c
mech_eap/util_tld.c

index 6eac550..fc0d1ab 100644 (file)
@@ -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) {
index 06da80e..8775c83 100644 (file)
@@ -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;
 }
 
index a30f5f3..10e3359 100644 (file)
@@ -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