Skip to content

Commit 98052d6

Browse files
dschoGit for Windows Build Agent
authored and
Git for Windows Build Agent
committed
Merge pull request #2535 from dscho/schannel-revoke-best-effort
Introduce and use the new "best effort" strategy for Secure Channel revoke checking
2 parents e4474a3 + 77c093c commit 98052d6

File tree

2 files changed

+29
-9
lines changed

2 files changed

+29
-9
lines changed

Documentation/config/http.txt

+7-5
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,13 @@ http.sslBackend::
152152

153153
http.schannelCheckRevoke::
154154
Used to enforce or disable certificate revocation checks in cURL
155-
when http.sslBackend is set to "schannel". Defaults to `true` if
156-
unset. Only necessary to disable this if Git consistently errors
157-
and the message is about checking the revocation status of a
158-
certificate. This option is ignored if cURL lacks support for
159-
setting the relevant SSL option at runtime.
155+
when http.sslBackend is set to "schannel" via "true" and "false",
156+
respectively. Another accepted value is "best-effort" (the default)
157+
in which case revocation checks are performed, but errors due to
158+
revocation list distribution points that are offline are silently
159+
ignored, as well as errors due to certificates missing revocation
160+
list distribution points. This option is ignored if cURL lacks
161+
support for setting the relevant SSL option at runtime.
160162

161163
http.schannelUseSSLCAInfo::
162164
As of cURL v7.60.0, the Secure Channel backend can use the

http.c

+22-4
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,13 @@ static char *cached_accept_language;
158158

159159
static char *http_ssl_backend;
160160

161-
static int http_schannel_check_revoke = 1;
161+
static int http_schannel_check_revoke_mode =
162+
#ifdef CURLSSLOPT_REVOKE_BEST_EFFORT
163+
CURLSSLOPT_REVOKE_BEST_EFFORT;
164+
#else
165+
CURLSSLOPT_NO_REVOKE;
166+
#endif
167+
162168
/*
163169
* With the backend being set to `schannel`, setting sslCAinfo would override
164170
* the Certificate Store in cURL v7.60.0 and later, which is not what we want
@@ -323,7 +329,19 @@ static int http_options(const char *var, const char *value, void *cb)
323329
}
324330

325331
if (!strcmp("http.schannelcheckrevoke", var)) {
326-
http_schannel_check_revoke = git_config_bool(var, value);
332+
if (value && !strcmp(value, "best-effort")) {
333+
http_schannel_check_revoke_mode =
334+
#ifdef CURLSSLOPT_REVOKE_BEST_EFFORT
335+
CURLSSLOPT_REVOKE_BEST_EFFORT;
336+
#else
337+
CURLSSLOPT_NO_REVOKE;
338+
warning(_("%s=%s unsupported by current cURL"),
339+
var, value);
340+
#endif
341+
} else
342+
http_schannel_check_revoke_mode =
343+
(git_config_bool(var, value) ?
344+
0 : CURLSSLOPT_NO_REVOKE);
327345
return 0;
328346
}
329347

@@ -869,9 +887,9 @@ static CURL *get_curl_handle(void)
869887
#endif
870888

871889
if (http_ssl_backend && !strcmp("schannel", http_ssl_backend) &&
872-
!http_schannel_check_revoke) {
890+
http_schannel_check_revoke_mode) {
873891
#if LIBCURL_VERSION_NUM >= 0x072c00
874-
curl_easy_setopt(result, CURLOPT_SSL_OPTIONS, CURLSSLOPT_NO_REVOKE);
892+
curl_easy_setopt(result, CURLOPT_SSL_OPTIONS, http_schannel_check_revoke_mode);
875893
#else
876894
warning(_("CURLSSLOPT_NO_REVOKE not supported with cURL < 7.44.0"));
877895
#endif

0 commit comments

Comments
 (0)