mirror of
https://github.com/curl/curl.git
synced 2026-08-25 15:53:39 +03:00
mbedtls: enforce verifyhost when verifypeer is disabled
Verify in test 2118 Closes #22475
This commit is contained in:
parent
1ea07d6e0a
commit
26fdb92c0a
5 changed files with 109 additions and 3 deletions
|
|
@ -453,9 +453,11 @@ static int mbed_verify_cb(void *ptr, mbedtls_x509_crt *crt,
|
|||
mbed_extract_certinfo(data, crt);
|
||||
}
|
||||
|
||||
/* `verifypeer` and `verifyhost` are independent, so clear the flags of a
|
||||
disabled check only. The name mismatch belongs to `verifyhost`. */
|
||||
if(!conn_config->verifypeer)
|
||||
*flags = 0;
|
||||
else if(!conn_config->verifyhost)
|
||||
*flags &= MBEDTLS_X509_BADCERT_CN_MISMATCH;
|
||||
if(!conn_config->verifyhost)
|
||||
*flags &= ~MBEDTLS_X509_BADCERT_CN_MISMATCH;
|
||||
|
||||
if(*flags) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue