Skip to content

Commit 5811746

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 d0c3ce5 + cfcc099 commit 5811746

File tree

2 files changed

+29
-9
lines changed

2 files changed

+29
-9
lines changed

Documentation/config/http.txt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -218,11 +218,13 @@ http.sslBackend::
218218

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

227229
http.schannelUseSSLCAInfo::
228230
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
@@ -147,7 +147,13 @@ static char *cached_accept_language;
147147

148148
static char *http_ssl_backend;
149149

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

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

@@ -1085,9 +1103,9 @@ static CURL *get_curl_handle(void)
10851103
#endif
10861104

10871105
if (http_ssl_backend && !strcmp("schannel", http_ssl_backend) &&
1088-
!http_schannel_check_revoke) {
1106+
http_schannel_check_revoke_mode) {
10891107
#ifdef GIT_CURL_HAVE_CURLSSLOPT_NO_REVOKE
1090-
curl_easy_setopt(result, CURLOPT_SSL_OPTIONS, CURLSSLOPT_NO_REVOKE);
1108+
curl_easy_setopt(result, CURLOPT_SSL_OPTIONS, http_schannel_check_revoke_mode);
10911109
#else
10921110
warning(_("CURLSSLOPT_NO_REVOKE not supported with cURL < 7.44.0"));
10931111
#endif

0 commit comments

Comments
 (0)