contains_wildcard() for DNs uses RDN enumerator
authorMartin Willi <martin@strongswan.org>
Fri, 3 Jul 2009 15:09:17 +0000 (17:09 +0200)
committerMartin Willi <martin@strongswan.org>
Mon, 6 Jul 2009 11:15:28 +0000 (13:15 +0200)
src/libstrongswan/utils/identification.c

index a257747..462a7e8 100644 (file)
@@ -795,30 +795,22 @@ static id_type_t get_type(private_identification_t *this)
  */
 static bool contains_wildcards_dn(private_identification_t *this)
 {
-       chunk_t rdn, attribute;
-       chunk_t oid, value;
-       asn1_t type;
-       bool next;
+       enumerator_t *enumerator;
+       bool contains = FALSE;
+       id_part_t type;
+       chunk_t data;
        
-       if (!init_rdn(this->encoded, &rdn, &attribute, &next))
-       {
-               return FALSE;
-       }       
-       /* fetch next RDN */
-       while (next)
+       enumerator = create_part_enumerator(this);
+       while (enumerator->enumerate(enumerator, &type, &data))
        {
-               /* parse next RDN and check for errors */
-               if (!get_next_rdn(&rdn, &attribute, &oid, &value, &type, &next))
+               if (data.len == 1 && data.ptr[0] == '*')
                {
-                       return FALSE;
-               }
-               /* check if RDN is a wildcard */
-               if (value.len == 1 && *value.ptr == '*')
-               {
-                       return TRUE;
+                       contains = TRUE;
+                       break;
                }
        }
-       return FALSE;
+       enumerator->destroy(enumerator);
+       return contains;
 }
 
 /**