Skip to content

Commit 001a8d2

Browse files
dschomjcheetham
authored andcommitted
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 7ef487d + 61341a6 commit 001a8d2

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
@@ -189,11 +189,13 @@ http.sslBackend::
189189

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

198200
http.schannelUseSSLCAInfo::
199201
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
@@ -141,7 +141,13 @@ static char *cached_accept_language;
141141

142142
static char *http_ssl_backend;
143143

144-
static int http_schannel_check_revoke = 1;
144+
static int http_schannel_check_revoke_mode =
145+
#ifdef CURLSSLOPT_REVOKE_BEST_EFFORT
146+
CURLSSLOPT_REVOKE_BEST_EFFORT;
147+
#else
148+
CURLSSLOPT_NO_REVOKE;
149+
#endif
150+
145151
/*
146152
* With the backend being set to `schannel`, setting sslCAinfo would override
147153
* the Certificate Store in cURL v7.60.0 and later, which is not what we want
@@ -403,7 +409,19 @@ static int http_options(const char *var, const char *value, void *cb)
403409
}
404410

405411
if (!strcmp("http.schannelcheckrevoke", var)) {
406-
http_schannel_check_revoke = git_config_bool(var, value);
412+
if (value && !strcmp(value, "best-effort")) {
413+
http_schannel_check_revoke_mode =
414+
#ifdef CURLSSLOPT_REVOKE_BEST_EFFORT
415+
CURLSSLOPT_REVOKE_BEST_EFFORT;
416+
#else
417+
CURLSSLOPT_NO_REVOKE;
418+
warning(_("%s=%s unsupported by current cURL"),
419+
var, value);
420+
#endif
421+
} else
422+
http_schannel_check_revoke_mode =
423+
(git_config_bool(var, value) ?
424+
0 : CURLSSLOPT_NO_REVOKE);
407425
return 0;
408426
}
409427

@@ -987,9 +1005,9 @@ static CURL *get_curl_handle(void)
9871005
#endif
9881006

9891007
if (http_ssl_backend && !strcmp("schannel", http_ssl_backend) &&
990-
!http_schannel_check_revoke) {
1008+
http_schannel_check_revoke_mode) {
9911009
#ifdef GIT_CURL_HAVE_CURLSSLOPT_NO_REVOKE
992-
curl_easy_setopt(result, CURLOPT_SSL_OPTIONS, CURLSSLOPT_NO_REVOKE);
1010+
curl_easy_setopt(result, CURLOPT_SSL_OPTIONS, http_schannel_check_revoke_mode);
9931011
#else
9941012
warning(_("CURLSSLOPT_NO_REVOKE not supported with cURL < 7.44.0"));
9951013
#endif

0 commit comments

Comments
 (0)