diff options
author | Martin Willi <martin@strongswan.org> | 2009-07-03 17:09:17 +0200 |
---|---|---|
committer | Martin Willi <martin@strongswan.org> | 2009-07-06 13:15:28 +0200 |
commit | 01da687f78dfd7c57c115e142c68db6ea75da173 (patch) | |
tree | 8241a8a214f1f2a6bc979bb9620aa30dcb2e0ebb /src | |
parent | d35650115bea2a634f2a61d7f833c2c5df17373a (diff) | |
download | strongswan-01da687f78dfd7c57c115e142c68db6ea75da173.tar.bz2 strongswan-01da687f78dfd7c57c115e142c68db6ea75da173.tar.xz |
contains_wildcard() for DNs uses RDN enumerator
Diffstat (limited to 'src')
-rw-r--r-- | src/libstrongswan/utils/identification.c | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/src/libstrongswan/utils/identification.c b/src/libstrongswan/utils/identification.c index a257747d5..462a7e8ed 100644 --- a/src/libstrongswan/utils/identification.c +++ b/src/libstrongswan/utils/identification.c @@ -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; } /** |