}
/**
+ * Special implementation of identification_t.equals for RFC822 and FQDN.
+ */
+static bool equals_strcasecmp(private_identification_t *this,
+ private_identification_t *other)
+{
+ /* we do some extra sanity checks to check for invalid IDs with a
+ * terminating null in it. */
+ if (this->encoded.len == other->encoded.len &&
+ memchr(this->encoded.ptr, 0, this->encoded.len) == NULL &&
+ memchr(other->encoded.ptr, 0, other->encoded.len) == NULL &&
+ strncasecmp(this->encoded.ptr, other->encoded.ptr, this->encoded.len) == 0)
+ {
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/**
* Default implementation of identification_t.matches.
*/
static bool matches_binary(private_identification_t *this,
this->encoded.len = strlen(string + 1);
this->public.matches = (bool (*)
(identification_t*,identification_t*,int*))matches_string;
+ this->public.equals = (bool (*)
+ (identification_t*,identification_t*))equals_strcasecmp;
return &(this->public);
}
}
this->encoded.len = strlen(string);
this->public.matches = (bool (*)
(identification_t*,identification_t*,int*))matches_string;
+ this->public.equals = (bool (*)
+ (identification_t*,identification_t*))equals_strcasecmp;
return &(this->public);
}
}
(identification_t*,identification_t*,int*))matches_any;
break;
case ID_FQDN:
- this->public.matches = (bool (*)
- (identification_t*,identification_t*,int*))matches_string;
- break;
case ID_RFC822_ADDR:
this->public.matches = (bool (*)
(identification_t*,identification_t*,int*))matches_string;
+ this->public.equals = (bool (*)
+ (identification_t*,identification_t*))equals_strcasecmp;
break;
case ID_DER_ASN1_DN:
this->public.equals = (bool (*)
}
return &(this->public);
}
+