Merge branch 'master' of ssh://moonshot.suchdamage.org:822/srv/git/moonshot
[mech_eap.git] / util_context.c
index 16a361f..d00965a 100644 (file)
  * SUCH DAMAGE.
  */
 
+/*
+ * Utility routines for context handles.
+ */
+
 #include "gssapiP_eap.h"
 
 OM_uint32
@@ -89,13 +93,13 @@ releaseAcceptorContext(struct gss_eap_acceptor_ctx *ctx)
 
     if (ctx->radConn != NULL)
         rs_conn_destroy(ctx->radConn);
-    if (ctx->radHandle != NULL)
-        rs_context_destroy(ctx->radHandle);
+    if (ctx->radContext != NULL)
+        rs_context_destroy(ctx->radContext);
     if (ctx->radServer != NULL)
         GSSEAP_FREE(ctx->radServer);
     gss_release_buffer(&tmpMinor, &ctx->state);
     if (ctx->vps != NULL)
-        pairfree(&ctx->vps);
+        gssEapRadiusFreeAvps(&tmpMinor, &ctx->vps);
 }
 
 OM_uint32
@@ -190,8 +194,10 @@ gssEapVerifyToken(OM_uint32 *minor,
         return major;
 
     if (ctx->mechanismUsed == GSS_C_NO_OID) {
-        if (!gssEapIsConcreteMechanismOid(oid))
+        if (!gssEapIsConcreteMechanismOid(oid)) {
+            *minor = GSSEAP_WRONG_MECH;
             return GSS_S_BAD_MECH;
+        }
 
         if (!gssEapInternalizeOid(oid, &ctx->mechanismUsed)) {
             major = duplicateOid(minor, oid, &ctx->mechanismUsed);