Simplify the SPNEGO neg_mechs intersection logic a bit using
authorGreg Hudson <ghudson@mit.edu>
Fri, 12 Feb 2010 19:18:17 +0000 (19:18 +0000)
committerGreg Hudson <ghudson@mit.edu>
Fri, 12 Feb 2010 19:18:17 +0000 (19:18 +0000)
gss_test_oid_set_member.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@23717 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/gssapi/spnego/spnego_mech.c

index 60fadd5e5ba84d6fd22096a455747c09f5abcc2d..bf695d84515cd80fae8d84389276c1f493b99f30 100644 (file)
@@ -2678,7 +2678,8 @@ get_negotiable_mechs(OM_uint32 *minor_status, spnego_gss_cred_id_t spcred,
        gss_cred_id_t creds = GSS_C_NO_CREDENTIAL, *credptr;
        gss_OID_set cred_mechs = GSS_C_NULL_OID_SET;
        gss_OID_set intersect_mechs = GSS_C_NULL_OID_SET;
-       unsigned int i, j;
+       unsigned int i;
+       int present;
 
        if (spcred == NULL) {
                /*
@@ -2715,12 +2716,10 @@ get_negotiable_mechs(OM_uint32 *minor_status, spnego_gss_cred_id_t spcred,
        }
 
        for (i = 0; i < spcred->neg_mechs->count; i++) {
-               for (j = 0; j < cred_mechs->count; j++) {
-                       if (!g_OID_equal(&spcred->neg_mechs->elements[i],
-                                        &cred_mechs->elements[j]))
-                               break;
-               }
-               if (j == cred_mechs->count)
+               gss_test_oid_set_member(&tmpmin,
+                                       &spcred->neg_mechs->elements[i],
+                                       cred_mechs, &present);
+               if (!present)
                        continue;
                ret = gss_add_oid_set_member(minor_status,
                                             &spcred->neg_mechs->elements[i],