Merge branch 'master' of ssh://moonshot.suchdamage.org:822/srv/git/moonshot
[mech_eap.git] / util_oid.c
index 45c37d8..7c63785 100644 (file)
  *
  */
 
+/*
+ * OID utility routines.
+ */
+
 #include "gssapiP_eap.h"
 
 OM_uint32
@@ -63,7 +67,6 @@ duplicateOid(OM_uint32 *minor,
 {
     gss_OID p;
 
-    *minor = 0;
     *newOid = GSS_C_NO_OID;
 
     p = (gss_OID)GSSEAP_MALLOC(sizeof(*p));
@@ -75,12 +78,14 @@ duplicateOid(OM_uint32 *minor,
     p->elements = GSSEAP_MALLOC(p->length);
     if (p->elements == NULL) {
         GSSEAP_FREE(p);
+        *minor = ENOMEM;
         return GSS_S_FAILURE;
     }
 
     memcpy(p->elements, oid->elements, p->length);
     *newOid = p;
 
+    *minor = 0;
     return GSS_S_COMPLETE;
 }
 
@@ -116,7 +121,7 @@ composeOid(OM_uint32 *minor,
     suffix = osuffix;
 
     if (oid->length < prefix_len + nbytes) {
-        *minor = ERANGE;
+        *minor = GSSEAP_WRONG_SIZE;
         return GSS_S_FAILURE;
     }