Avoid enumerating certificates with non-matching key type

If the key type was specified but the ID was NULL or matched a subject, it
was possible that a certificate was returned that didn't actually match
the requested key type.

Closes strongswan/strongswan#141.
This commit is contained in:
SophieK 2019-05-21 09:28:21 +08:00 committed by Tobias Brunner
parent 55dd0361b8
commit 3aa7b2dc3a
2 changed files with 10 additions and 0 deletions

View File

@ -208,6 +208,11 @@ CALLBACK(certs_filter, bool,
return TRUE;
}
}
else
{
public->destroy(public);
continue;
}
public->destroy(public);
}
else if (data->key != KEY_ANY)

View File

@ -108,6 +108,11 @@ CALLBACK(certs_filter, bool,
return TRUE;
}
}
else
{
public->destroy(public);
continue;
}
public->destroy(public);
}
else if (data->key != KEY_ANY)