gss_inquire_name stub
[mech_eap.orig] / util_context.c
index d7a87d3..b6dec71 100644 (file)
@@ -47,8 +47,8 @@ gssEapAllocContext(OM_uint32 *minor,
         return GSS_S_FAILURE;
     }
 
-    *minor = krb5_init_context(&ctx->kerberosCtx);
-    if (*minor != 0) {
+    if (GSSEAP_MUTEX_INIT(&ctx->mutex) != 0) {
+        *minor = errno;
         gssEapReleaseContext(&tmpMinor, &ctx);
         return GSS_S_FAILURE;
     }
@@ -76,30 +76,28 @@ gssEapReleaseContext(OM_uint32 *minor,
 {
     OM_uint32 major, tmpMinor;
     gss_ctx_id_t ctx = *pCtx;
+    krb5_context krbContext = NULL;
 
     if (ctx == GSS_C_NO_CONTEXT) {
         return GSS_S_COMPLETE;
     }
 
+    gssEapKerberosInit(&tmpMinor, &krbContext);
+
     if (CTX_IS_INITIATOR(ctx)) {
         releaseInitiatorContext(&ctx->initiatorCtx);
     } else {
         releaseAcceptorContext(&ctx->acceptorCtx);
     }
 
-    if (ctx->rfc3961Key != NULL) {
-        krb5_free_keyblock(ctx->kerberosCtx, ctx->rfc3961Key);
-    }
-
-    if (ctx->kerberosCtx != NULL) {
-        krb5_free_context(ctx->kerberosCtx);
-    }
-
+    krb5_free_keyblock_contents(krbContext, &ctx->rfc3961Key);
     gssEapReleaseName(&tmpMinor, &ctx->initiatorName);
     gssEapReleaseName(&tmpMinor, &ctx->acceptorName);
     gss_release_oid(&tmpMinor, &ctx->mechanismUsed);
     sequenceFree(ctx->seqState);
 
+    GSSEAP_MUTEX_DESTROY(&ctx->mutex);
+
     memset(ctx, 0, sizeof(*ctx));
     GSSEAP_FREE(ctx);
     *pCtx = GSS_C_NO_CONTEXT;