mirror of
https://github.com/curl/curl.git
synced 2026-08-26 05:43:31 +03:00
doh: add options to disable ssl verification
- New libcurl options CURLOPT_DOH_SSL_VERIFYHOST, CURLOPT_DOH_SSL_VERIFYPEER and CURLOPT_DOH_SSL_VERIFYSTATUS do the same as their respective counterparts. - New curl tool options --doh-insecure and --doh-cert-status do the same as their respective counterparts. Prior to this change DOH SSL certificate verification settings for verifyhost and verifypeer were supposed to be inherited respectively from CURLOPT_SSL_VERIFYHOST and CURLOPT_SSL_VERIFYPEER, but due to a bug were not. As a result DOH verification remained at the default, ie enabled, and it was not possible to disable. This commit changes behavior so that the DOH verification settings are independent and not inherited. Ref: https://github.com/curl/curl/pull/4579#issuecomment-554723676 Fixes https://github.com/curl/curl/issues/4578 Closes https://github.com/curl/curl/pull/6597
This commit is contained in:
parent
b68026f7f4
commit
53022e1893
22 changed files with 404 additions and 44 deletions
30
lib/setopt.c
30
lib/setopt.c
|
|
@ -1848,6 +1848,13 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
|
|||
data->set.ssl.primary.verifypeer;
|
||||
}
|
||||
break;
|
||||
case CURLOPT_DOH_SSL_VERIFYPEER:
|
||||
/*
|
||||
* Enable peer SSL verifying for DOH.
|
||||
*/
|
||||
data->set.doh_verifypeer = (0 != va_arg(param, long)) ?
|
||||
TRUE : FALSE;
|
||||
break;
|
||||
#ifndef CURL_DISABLE_PROXY
|
||||
case CURLOPT_PROXY_SSL_VERIFYPEER:
|
||||
/*
|
||||
|
|
@ -1880,6 +1887,15 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
|
|||
data->set.ssl.primary.verifyhost;
|
||||
}
|
||||
break;
|
||||
case CURLOPT_DOH_SSL_VERIFYHOST:
|
||||
/*
|
||||
* Enable verification of the host name in the peer certificate for DOH
|
||||
*/
|
||||
arg = va_arg(param, long);
|
||||
|
||||
/* Treat both 1 and 2 as TRUE */
|
||||
data->set.doh_verifyhost = (bool)((arg & 3) ? TRUE : FALSE);
|
||||
break;
|
||||
#ifndef CURL_DISABLE_PROXY
|
||||
case CURLOPT_PROXY_SSL_VERIFYHOST:
|
||||
/*
|
||||
|
|
@ -1915,6 +1931,18 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
|
|||
data->set.ssl.primary.verifystatus;
|
||||
}
|
||||
break;
|
||||
case CURLOPT_DOH_SSL_VERIFYSTATUS:
|
||||
/*
|
||||
* Enable certificate status verifying for DOH.
|
||||
*/
|
||||
if(!Curl_ssl_cert_status_request()) {
|
||||
result = CURLE_NOT_BUILT_IN;
|
||||
break;
|
||||
}
|
||||
|
||||
data->set.doh_verifystatus = (0 != va_arg(param, long)) ?
|
||||
TRUE : FALSE;
|
||||
break;
|
||||
case CURLOPT_SSL_CTX_FUNCTION:
|
||||
/*
|
||||
* Set a SSL_CTX callback
|
||||
|
|
@ -2240,6 +2268,8 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
|
|||
data->set.ssl.no_partialchain = !!(arg & CURLSSLOPT_NO_PARTIALCHAIN);
|
||||
data->set.ssl.revoke_best_effort = !!(arg & CURLSSLOPT_REVOKE_BEST_EFFORT);
|
||||
data->set.ssl.native_ca_store = !!(arg & CURLSSLOPT_NATIVE_CA);
|
||||
/* If a setting is added here it should also be added in dohprobe()
|
||||
which sets its own CURLOPT_SSL_OPTIONS based on these settings. */
|
||||
break;
|
||||
|
||||
#ifndef CURL_DISABLE_PROXY
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue