Skip to content

Commit 97492aa

Browse files
committed
Merge branch 'ab/http-pinned-public-key-mismatch'
HTTPS error handling updates. * ab/http-pinned-public-key-mismatch: http: check CURLE_SSL_PINNEDPUBKEYNOTMATCH when emitting errors
2 parents 4ae0bc7 + 3e8084f commit 97492aa

File tree

4 files changed

+11
-1
lines changed

4 files changed

+11
-1
lines changed

git-curl-compat.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,11 @@
6767

6868
/**
6969
* CURLOPT_PINNEDPUBLICKEY was added in 7.39.0, released in November
70-
* 2014.
70+
* 2014. CURLE_SSL_PINNEDPUBKEYNOTMATCH was added in that same version.
7171
*/
7272
#if LIBCURL_VERSION_NUM >= 0x072c00
7373
#define GIT_CURL_HAVE_CURLOPT_PINNEDPUBLICKEY 1
74+
#define GIT_CURL_HAVE_CURLE_SSL_PINNEDPUBKEYNOTMATCH 1
7475
#endif
7576

7677
/**

http.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1489,6 +1489,10 @@ static int handle_curl_result(struct slot_results *results)
14891489
*/
14901490
credential_reject(&cert_auth);
14911491
return HTTP_NOAUTH;
1492+
#ifdef GIT_CURL_HAVE_CURLE_SSL_PINNEDPUBKEYNOTMATCH
1493+
} else if (results->curl_result == CURLE_SSL_PINNEDPUBKEYNOTMATCH) {
1494+
return HTTP_NOMATCHPUBLICKEY;
1495+
#endif
14921496
} else if (missing_target(results))
14931497
return HTTP_MISSING_TARGET;
14941498
else if (results->http_code == 401) {

http.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ struct http_get_options {
154154
#define HTTP_START_FAILED 3
155155
#define HTTP_REAUTH 4
156156
#define HTTP_NOAUTH 5
157+
#define HTTP_NOMATCHPUBLICKEY 6
157158

158159
/*
159160
* Requests a URL and stores the result in a strbuf.

remote-curl.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,10 @@ static struct discovery *discover_refs(const char *service, int for_push)
499499
show_http_message(&type, &charset, &buffer);
500500
die(_("Authentication failed for '%s'"),
501501
transport_anonymize_url(url.buf));
502+
case HTTP_NOMATCHPUBLICKEY:
503+
show_http_message(&type, &charset, &buffer);
504+
die(_("unable to access '%s' with http.pinnedPubkey configuration: %s"),
505+
transport_anonymize_url(url.buf), curl_errorstr);
502506
default:
503507
show_http_message(&type, &charset, &buffer);
504508
die(_("unable to access '%s': %s"),

0 commit comments

Comments
 (0)