initial libradsec port
[mech_eap.orig] / util_context.c
index 37edb63..be42260 100644 (file)
@@ -76,6 +76,9 @@ gssEapAllocContext(OM_uint32 *minor,
 static void
 releaseInitiatorContext(struct gss_eap_initiator_ctx *ctx)
 {
+    OM_uint32 minor;
+
+    gssEapReleaseCred(&minor, &ctx->defaultCred);
     eap_peer_sm_deinit(ctx->eap);
 }
 
@@ -84,12 +87,15 @@ releaseAcceptorContext(struct gss_eap_acceptor_ctx *ctx)
 {
     OM_uint32 tmpMinor;
 
-    if (ctx->avps != NULL)
-        rc_avpair_free(ctx->avps);
+    if (ctx->radConn != NULL)
+        rs_conn_destroy(ctx->radConn);
     if (ctx->radHandle != NULL)
-        rc_config_free(ctx->radHandle);
-
+        rs_context_destroy(ctx->radHandle);
+    if (ctx->radServer != NULL)
+        GSSEAP_FREE(ctx->radServer);
     gss_release_buffer(&tmpMinor, &ctx->state);
+    if (ctx->avps != NULL)
+        pairfree(&ctx->avps);
 }
 
 OM_uint32
@@ -206,16 +212,6 @@ gssEapContextTime(OM_uint32 *minor,
                   gss_ctx_id_t context_handle,
                   OM_uint32 *time_rec)
 {
-    if (context_handle == GSS_C_NO_CONTEXT) {
-        return GSS_S_NO_CONTEXT;
-    }
-
-    if (!CTX_IS_ESTABLISHED(context_handle)) {
-        return GSS_S_NO_CONTEXT;
-    }
-
-    *minor = 0;
-
     if (context_handle->expiryTime == 0) {
         *time_rec = GSS_C_INDEFINITE;
     } else {