summaryrefslogtreecommitdiff
path: root/src/libstrongswan/utils/identification.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstrongswan/utils/identification.c')
-rw-r--r--src/libstrongswan/utils/identification.c36
1 files changed, 33 insertions, 3 deletions
diff --git a/src/libstrongswan/utils/identification.c b/src/libstrongswan/utils/identification.c
index ff97f3610..bce6b1cc2 100644
--- a/src/libstrongswan/utils/identification.c
+++ b/src/libstrongswan/utils/identification.c
@@ -14,7 +14,7 @@
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
- * $Id: identification.c 4936 2009-03-12 18:07:32Z tobias $
+ * $Id: identification.c 5036 2009-03-26 13:25:46Z martin $
*/
#define _GNU_SOURCE
@@ -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;
-
}
}