diff options
author | Tobias Brunner <tobias@strongswan.org> | 2016-04-06 12:16:11 +0200 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2016-06-06 13:49:41 +0200 |
commit | a366fa365e199c97b55f418afb210fd6ebbcdbd4 (patch) | |
tree | 3db2fe36791c265e2304ca05e6b8bb18c3a5c722 | |
parent | a6289d932362a2b85043d9fdc3cf9535c393631c (diff) | |
download | strongswan-a366fa365e199c97b55f418afb210fd6ebbcdbd4.tar.bz2 strongswan-a366fa365e199c97b55f418afb210fd6ebbcdbd4.tar.xz |
identification: Compare identity types when comparing ID_FQDN/ID_RFC822_ADDR identities
References #1380.
-rw-r--r-- | src/libstrongswan/utils/identification.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/libstrongswan/utils/identification.c b/src/libstrongswan/utils/identification.c index 9084335bb..384bd6c92 100644 --- a/src/libstrongswan/utils/identification.c +++ b/src/libstrongswan/utils/identification.c @@ -729,7 +729,8 @@ METHOD(identification_t, equals_strcasecmp, bool, /* we do some extra sanity checks to check for invalid IDs with a * terminating null in it. */ - if (this->encoded.len == encoded.len && + if (this->type == other->get_type(other) && + this->encoded.len == encoded.len && memchr(this->encoded.ptr, 0, this->encoded.len) == NULL && memchr(encoded.ptr, 0, encoded.len) == NULL && strncasecmp(this->encoded.ptr, encoded.ptr, this->encoded.len) == 0) @@ -1154,15 +1155,15 @@ static private_identification_t *identification_create(id_type_t type) { case ID_ANY: this->public.hash = _hash_binary; - this->public.matches = _matches_any; this->public.equals = _equals_binary; + this->public.matches = _matches_any; this->public.contains_wildcards = return_true; break; case ID_FQDN: case ID_RFC822_ADDR: this->public.hash = _hash_binary; - this->public.matches = _matches_string; this->public.equals = _equals_strcasecmp; + this->public.matches = _matches_string; this->public.contains_wildcards = _contains_wildcards_memchr; break; case ID_DER_ASN1_DN: |