Skip to content

Commit fe14330

Browse files
dschoGit for Windows Build Agent
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 088b64c + 6260c0b commit fe14330

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

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

182184
http.schannelUseSSLCAInfo::
183185
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
@@ -168,7 +168,13 @@ static char *cached_accept_language;
168168

169169
static char *http_ssl_backend;
170170

171-
static int http_schannel_check_revoke = 1;
171+
static int http_schannel_check_revoke_mode =
172+
#ifdef CURLSSLOPT_REVOKE_BEST_EFFORT
173+
CURLSSLOPT_REVOKE_BEST_EFFORT;
174+
#else
175+
CURLSSLOPT_NO_REVOKE;
176+
#endif
177+
172178
/*
173179
* With the backend being set to `schannel`, setting sslCAinfo would override
174180
* the Certificate Store in cURL v7.60.0 and later, which is not what we want
@@ -383,7 +389,19 @@ static int http_options(const char *var, const char *value, void *cb)
383389
}
384390

385391
if (!strcmp("http.schannelcheckrevoke", var)) {
386-
http_schannel_check_revoke = git_config_bool(var, value);
392+
if (value && !strcmp(value, "best-effort")) {
393+
http_schannel_check_revoke_mode =
394+
#ifdef CURLSSLOPT_REVOKE_BEST_EFFORT
395+
CURLSSLOPT_REVOKE_BEST_EFFORT;
396+
#else
397+
CURLSSLOPT_NO_REVOKE;
398+
warning(_("%s=%s unsupported by current cURL"),
399+
var, value);
400+
#endif
401+
} else
402+
http_schannel_check_revoke_mode =
403+
(git_config_bool(var, value) ?
404+
0 : CURLSSLOPT_NO_REVOKE);
387405
return 0;
388406
}
389407

@@ -961,9 +979,9 @@ static CURL *get_curl_handle(void)
961979
#endif
962980

963981
if (http_ssl_backend && !strcmp("schannel", http_ssl_backend) &&
964-
!http_schannel_check_revoke) {
982+
http_schannel_check_revoke_mode) {
965983
#if LIBCURL_VERSION_NUM >= 0x072c00
966-
curl_easy_setopt(result, CURLOPT_SSL_OPTIONS, CURLSSLOPT_NO_REVOKE);
984+
curl_easy_setopt(result, CURLOPT_SSL_OPTIONS, http_schannel_check_revoke_mode);
967985
#else
968986
warning(_("CURLSSLOPT_NO_REVOKE not supported with cURL < 7.44.0"));
969987
#endif

0 commit comments

Comments
 (0)