mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-01 19:54:40 +02:00
Check names in verify callback.
This commit is contained in:
@@ -9339,11 +9339,22 @@ static int DoVerifyCallback(WOLFSSL* ssl, int ret, ProcPeerCertArgs* args)
|
|||||||
#endif
|
#endif
|
||||||
#if defined(OPENSSL_EXTRA)
|
#if defined(OPENSSL_EXTRA)
|
||||||
/* perform domain name check on the peer certificate */
|
/* perform domain name check on the peer certificate */
|
||||||
if (args->dCertInit && args->dCert && args->dCert->subjectCN \
|
if (args->dCertInit && args->dCert &&
|
||||||
&& ssl->param && ssl->param->hostName[0]) {
|
ssl->param && ssl->param->hostName[0]) {
|
||||||
|
/* If altNames names is present, then subject common name is ignored */
|
||||||
if(XSTRSTR(args->dCert->subjectCN, ssl->param->hostName) == NULL) {
|
if (args->dCert->altNames != NULL) {
|
||||||
return VERIFY_CERT_ERROR;
|
if (CheckAltNames(args->dCert, ssl->param->hostName) == 0 ) {
|
||||||
|
return VERIFY_CERT_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (args->dCert->subjectCN) {
|
||||||
|
if (MatchDomainName(args->dCert->subjectCN,
|
||||||
|
args->dCert->subjectCNLen,
|
||||||
|
ssl->param->hostName) == 0) {
|
||||||
|
return VERIFY_CERT_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user