"C=CH, E=moon@strongswan.org, CN=moon");
ck_assert(id_equals(a, "C=CH, E=moon@strongswan.org, CN=moon"));
- ck_assert(id_equals(a, "C==CH, E==moon@strongswan.org,,, CN==moon"));
+ ck_assert(id_equals(a, "C==CH , E==moon@strongswan.org , CN==moon"));
ck_assert(id_equals(a, " C=CH, E=moon@strongswan.org, CN=moon "));
ck_assert(id_equals(a, "C=ch, E=moon@STRONGSWAN.ORG, CN=Moon"));
ck_assert(id_equals(a, "/C=CH/E=moon@strongswan.org/CN=moon"));
- ck_assert(id_equals(a, "C=CH/E=moon@strongswan.org/CN=moon"));
- ck_assert(id_equals(a, "C=CH/E=moon@strongswan.org,CN=moon"));
- ck_assert(id_equals(a, "C=CH / E=moon@strongswan.org , CN=moon"));
+ ck_assert(id_equals(a, " / C=CH / E=moon@strongswan.org / CN=moon"));
+ ck_assert(!id_equals(a, "C=CH/E=moon@strongswan.org/CN=moon"));
+ ck_assert(!id_equals(a, "C=CH/E=moon@strongswan.org,CN=moon"));
ck_assert(!id_equals(a, "C=CH E=moon@strongswan.org CN=moon"));
ck_assert(!id_equals(a, "C=CN, E=moon@strongswan.org, CN=moon"));
ck_assert(!id_equals(a, "E=moon@strongswan.org, C=CH, CN=moon"));
asn1_t rdn_type;
state_t state = SEARCH_OID;
status_t status = SUCCESS;
+ char sep = '\0';
do
{
switch (state)
{
case SEARCH_OID:
- if (*src != ' ' && *src != '/' && *src != ',' && *src != '\0')
+ if (!sep && *src == '/')
+ { /* use / as separator if the string starts with a slash */
+ sep = '/';
+ break;
+ }
+ if (*src != ' ' && *src != '\0')
{
+ if (!sep)
+ { /* use , as separator by default */
+ sep = ',';
+ }
oid.ptr = src;
oid.len = 1;
state = READ_OID;
{
break;
}
- else if (*src != ',' && *src != '/' && *src != '\0')
+ else if (*src != sep && *src != '\0')
{
name.ptr = src;
name.len = 1;
state = READ_NAME;
/* fall-through */
case READ_NAME:
- if (*src != ',' && *src != '/' && *src != '\0')
+ if (*src != sep && *src != '\0')
{
name.len++;
if (*src == ' ')