aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Willi <martin@strongswan.org>2009-03-26 13:25:46 +0000
committerMartin Willi <martin@strongswan.org>2009-03-26 13:25:46 +0000
commite82c3695194c82a4b65b74825e9ca274f03fac47 (patch)
tree71207b06f5d1f627a9452db1b2fe9d6e7e924c5c
parentf32a321a57c2ba287d119b8cad16a10a525800bf (diff)
downloadstrongswan-e82c3695194c82a4b65b74825e9ca274f03fac47.tar.bz2
strongswan-e82c3695194c82a4b65b74825e9ca274f03fac47.tar.xz
implementation of contains_wildcards() for ID_DER_ASN1_DN identities
-rw-r--r--src/libstrongswan/utils/identification.c34
1 files changed, 32 insertions, 2 deletions
diff --git a/src/libstrongswan/utils/identification.c b/src/libstrongswan/utils/identification.c
index 44e63b626..9497f3569 100644
--- a/src/libstrongswan/utils/identification.c
+++ b/src/libstrongswan/utils/identification.c
@@ -716,6 +716,37 @@ static id_type_t get_type(private_identification_t *this)
}
/**
+ * Implementation of identification_t.contains_wildcards fro ID_DER_ASN1_DN.
+ */
+static bool contains_wildcards_dn(private_identification_t *this)
+{
+ chunk_t rdn, attribute;
+ chunk_t oid, value;
+ asn1_t type;
+ bool next;
+
+ if (!init_rdn(this->encoded, &rdn, &attribute, &next))
+ {
+ return FALSE;
+ }
+ /* fetch next RDN */
+ while (next)
+ {
+ /* parse next RDN and check for errors */
+ if (!get_next_rdn(&rdn, &attribute, &oid, &value, &type, &next))
+ {
+ return FALSE;
+ }
+ /* check if RDN is a wildcard */
+ if (value.len == 1 && *value.ptr == '*')
+ {
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+/**
* Implementation of identification_t.contains_wildcards.
*/
static bool contains_wildcards(private_identification_t *this)
@@ -728,10 +759,9 @@ static bool contains_wildcards(private_identification_t *this)
case ID_RFC822_ADDR:
return memchr(this->encoded.ptr, '*', this->encoded.len) != NULL;
case ID_DER_ASN1_DN:
- /* TODO */
+ return contains_wildcards_dn(this);
default:
return FALSE;
-
}
}