Merge branch 'master' of ssh://moonshot.suchdamage.org:822/srv/git/moonshot
[mech_eap.orig] / get_mic.c
index 2fa71a2..172e21a 100644 (file)
--- a/get_mic.c
+++ b/get_mic.c
  * SUCH DAMAGE.
  */
 
+/*
+ * Message protection services: make a message integerity check.
+ */
+
 #include "gssapiP_eap.h"
 
 OM_uint32
 gss_get_mic(OM_uint32 *minor,
             gss_ctx_id_t ctx,
-            gss_qop_t qop_req __attribute__((__unused__)),
+            gss_qop_t qop_req,
             gss_buffer_t message_buffer,
             gss_buffer_t message_token)
 {
@@ -47,6 +51,11 @@ gss_get_mic(OM_uint32 *minor,
         return GSS_S_NO_CONTEXT;
     }
 
+    if (qop_req != GSS_C_QOP_DEFAULT) {
+        *minor = GSSEAP_UNKNOWN_QOP;
+        return GSS_S_UNAVAILABLE;
+    }
+
     *minor = 0;
 
     message_token->value = NULL;
@@ -55,8 +64,8 @@ gss_get_mic(OM_uint32 *minor,
     GSSEAP_MUTEX_LOCK(&ctx->mutex);
 
     if (!CTX_IS_ESTABLISHED(ctx)) {
-        *minor = GSSEAP_CONTEXT_INCOMPLETE;
         major = GSS_S_NO_CONTEXT;
+        *minor = GSSEAP_CONTEXT_INCOMPLETE;
         goto cleanup;
     }