Skip to content

Commit e1f0c1f

Browse files
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 c48dbf1 + 41db584 commit e1f0c1f

File tree

2 files changed

+29
-9
lines changed

2 files changed

+29
-9
lines changed

Documentation/config/http.adoc

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,13 @@ http.sslKeyType::
233233

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

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

http.c

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,13 @@ static char *cached_accept_language;
148148

149149
static char *http_ssl_backend;
150150

151-
static int http_schannel_check_revoke = 1;
151+
static long http_schannel_check_revoke_mode =
152+
#ifdef CURLSSLOPT_REVOKE_BEST_EFFORT
153+
CURLSSLOPT_REVOKE_BEST_EFFORT;
154+
#else
155+
CURLSSLOPT_NO_REVOKE;
156+
#endif
157+
152158
/*
153159
* With the backend being set to `schannel`, setting sslCAinfo would override
154160
* the Certificate Store in cURL v7.60.0 and later, which is not what we want
@@ -423,7 +429,19 @@ static int http_options(const char *var, const char *value,
423429
}
424430

425431
if (!strcmp("http.schannelcheckrevoke", var)) {
426-
http_schannel_check_revoke = git_config_bool(var, value);
432+
if (value && !strcmp(value, "best-effort")) {
433+
http_schannel_check_revoke_mode =
434+
#ifdef CURLSSLOPT_REVOKE_BEST_EFFORT
435+
CURLSSLOPT_REVOKE_BEST_EFFORT;
436+
#else
437+
CURLSSLOPT_NO_REVOKE;
438+
warning(_("%s=%s unsupported by current cURL"),
439+
var, value);
440+
#endif
441+
} else
442+
http_schannel_check_revoke_mode =
443+
(git_config_bool(var, value) ?
444+
0 : CURLSSLOPT_NO_REVOKE);
427445
return 0;
428446
}
429447

@@ -1057,8 +1075,8 @@ static CURL *get_curl_handle(void)
10571075
#endif
10581076

10591077
if (http_ssl_backend && !strcmp("schannel", http_ssl_backend) &&
1060-
!http_schannel_check_revoke) {
1061-
curl_easy_setopt(result, CURLOPT_SSL_OPTIONS, (long)CURLSSLOPT_NO_REVOKE);
1078+
http_schannel_check_revoke_mode) {
1079+
curl_easy_setopt(result, CURLOPT_SSL_OPTIONS, http_schannel_check_revoke_mode);
10621080
}
10631081

10641082
if (http_proactive_auth != PROACTIVE_AUTH_NONE)

0 commit comments

Comments
 (0)