util_saml: correctly account for gss lengths
[mech_eap.orig] / inquire_saslname_for_mech.c
index 1565d66..aec2a85 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, JANET(UK)
+ * Copyright (c) 2011, JANET(UK)
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * SUCH DAMAGE.
  */
 
+/*
+ * Map SASL mechanism name to a mechanism OID.
+ */
+
 #include "gssapiP_eap.h"
 
 OM_uint32
@@ -38,8 +42,10 @@ gss_inquire_mech_for_saslname(OM_uint32 *minor,
                               gss_OID *mech_type)
 {
     *mech_type = gssEapSaslNameToOid(sasl_mech_name);
-    if (*mech_type == GSS_C_NO_OID)
+    if (*mech_type == GSS_C_NO_OID) {
+        *minor = GSSEAP_WRONG_MECH;
         return GSS_S_BAD_MECH;
+    }
 
     return GSS_S_COMPLETE;
 }