diff options
| author | Robert Joslyn <robert.joslyn@redrectangle.org> | 2022-06-05 14:47:33 -0700 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-06-11 10:06:09 +0100 |
| commit | 7da79fcac2eb04435735f31a2a5c5d085a19db3b (patch) | |
| tree | 75d5efc02c8bb229081dac867751e76bf9d55b2d /meta/recipes-support | |
| parent | 1be2437fd2a8c039535839cd05f8bbf6cbd805a4 (diff) | |
| download | poky-7da79fcac2eb04435735f31a2a5c5d085a19db3b.tar.gz | |
curl: Backport CVE fixes
Backport patches to address CVE-2022-27774, CVE-2022-27781, and
CVE-2022-27782.
(From OE-Core rev: f8cdafc0ef54ab203164366ad96288fd10144b30)
Signed-off-by: Robert Joslyn <robert.joslyn@redrectangle.org>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-support')
| -rw-r--r-- | meta/recipes-support/curl/curl/CVE-2022-27774-1.patch | 45 | ||||
| -rw-r--r-- | meta/recipes-support/curl/curl/CVE-2022-27774-2.patch | 80 | ||||
| -rw-r--r-- | meta/recipes-support/curl/curl/CVE-2022-27774-3.patch | 83 | ||||
| -rw-r--r-- | meta/recipes-support/curl/curl/CVE-2022-27774-4.patch | 35 | ||||
| -rw-r--r-- | meta/recipes-support/curl/curl/CVE-2022-27781.patch | 46 | ||||
| -rw-r--r-- | meta/recipes-support/curl/curl/CVE-2022-27782-1.patch | 363 | ||||
| -rw-r--r-- | meta/recipes-support/curl/curl/CVE-2022-27782-2.patch | 71 | ||||
| -rw-r--r-- | meta/recipes-support/curl/curl_7.69.1.bb | 7 |
8 files changed, 730 insertions, 0 deletions
diff --git a/meta/recipes-support/curl/curl/CVE-2022-27774-1.patch b/meta/recipes-support/curl/curl/CVE-2022-27774-1.patch new file mode 100644 index 0000000000..063c11712a --- /dev/null +++ b/meta/recipes-support/curl/curl/CVE-2022-27774-1.patch | |||
| @@ -0,0 +1,45 @@ | |||
| 1 | From 2a797e099731facf62a2c675396334bc2ad3bc7c Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Daniel Stenberg <daniel@haxx.se> | ||
| 3 | Date: Mon, 25 Apr 2022 16:24:33 +0200 | ||
| 4 | Subject: [PATCH] connect: store "conn_remote_port" in the info struct | ||
| 5 | |||
| 6 | To make it available after the connection ended. | ||
| 7 | |||
| 8 | Prerequisite for the patches that address CVE-2022-27774. | ||
| 9 | |||
| 10 | Upstream-Status: Backport [https://github.com/curl/curl/commit/08b8ef4e726ba10f45081ecda5b3cea788d3c839] | ||
| 11 | Signed-off-by: Robert Joslyn <robert.joslyn@redrectangle.org> | ||
| 12 | --- | ||
| 13 | lib/connect.c | 1 + | ||
| 14 | lib/urldata.h | 6 +++++- | ||
| 15 | 2 files changed, 6 insertions(+), 1 deletion(-) | ||
| 16 | |||
| 17 | diff --git a/lib/connect.c b/lib/connect.c | ||
| 18 | index b3d4057..a977d67 100644 | ||
| 19 | --- a/lib/connect.c | ||
| 20 | +++ b/lib/connect.c | ||
| 21 | @@ -624,6 +624,7 @@ void Curl_persistconninfo(struct connectdata *conn) | ||
| 22 | conn->data->info.conn_scheme = conn->handler->scheme; | ||
| 23 | conn->data->info.conn_protocol = conn->handler->protocol; | ||
| 24 | conn->data->info.conn_primary_port = conn->primary_port; | ||
| 25 | + conn->data->info.conn_remote_port = conn->remote_port; | ||
| 26 | conn->data->info.conn_local_port = conn->local_port; | ||
| 27 | } | ||
| 28 | |||
| 29 | diff --git a/lib/urldata.h b/lib/urldata.h | ||
| 30 | index fafb7a3..ab1b267 100644 | ||
| 31 | --- a/lib/urldata.h | ||
| 32 | +++ b/lib/urldata.h | ||
| 33 | @@ -1148,7 +1148,11 @@ struct PureInfo { | ||
| 34 | reused, in the connection cache. */ | ||
| 35 | |||
| 36 | char conn_primary_ip[MAX_IPADR_LEN]; | ||
| 37 | - long conn_primary_port; | ||
| 38 | + long conn_primary_port; /* this is the destination port to the connection, | ||
| 39 | + which might have been a proxy */ | ||
| 40 | + long conn_remote_port; /* this is the "remote port", which is the port | ||
| 41 | + number of the used URL, independent of proxy or | ||
| 42 | + not */ | ||
| 43 | char conn_local_ip[MAX_IPADR_LEN]; | ||
| 44 | long conn_local_port; | ||
| 45 | const char *conn_scheme; | ||
diff --git a/meta/recipes-support/curl/curl/CVE-2022-27774-2.patch b/meta/recipes-support/curl/curl/CVE-2022-27774-2.patch new file mode 100644 index 0000000000..c64d614194 --- /dev/null +++ b/meta/recipes-support/curl/curl/CVE-2022-27774-2.patch | |||
| @@ -0,0 +1,80 @@ | |||
| 1 | From 5c2f3b3a5f115625134669d90d591de9c5aafc8e Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Daniel Stenberg <daniel@haxx.se> | ||
| 3 | Date: Mon, 25 Apr 2022 16:24:33 +0200 | ||
| 4 | Subject: [PATCH] transfer: redirects to other protocols or ports clear auth | ||
| 5 | |||
| 6 | ... unless explicitly permitted. | ||
| 7 | |||
| 8 | Bug: https://curl.se/docs/CVE-2022-27774.html | ||
| 9 | Reported-by: Harry Sintonen | ||
| 10 | Closes #8748 | ||
| 11 | |||
| 12 | Upstream-Status: Backport [https://github.com/curl/curl/commit/620ea21410030a9977396b4661806bc187231b79] | ||
| 13 | Signed-off-by: Robert Joslyn <robert.joslyn@redrectangle.org> | ||
| 14 | --- | ||
| 15 | lib/transfer.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++++- | ||
| 16 | 1 file changed, 48 insertions(+), 1 deletion(-) | ||
| 17 | |||
| 18 | diff --git a/lib/transfer.c b/lib/transfer.c | ||
| 19 | index 744e1c0..ac69d27 100644 | ||
| 20 | --- a/lib/transfer.c | ||
| 21 | +++ b/lib/transfer.c | ||
| 22 | @@ -1627,10 +1627,57 @@ CURLcode Curl_follow(struct Curl_easy *data, | ||
| 23 | return CURLE_OUT_OF_MEMORY; | ||
| 24 | } | ||
| 25 | else { | ||
| 26 | - | ||
| 27 | uc = curl_url_get(data->state.uh, CURLUPART_URL, &newurl, 0); | ||
| 28 | if(uc) | ||
| 29 | return Curl_uc_to_curlcode(uc); | ||
| 30 | + | ||
| 31 | + /* Clear auth if this redirects to a different port number or protocol, | ||
| 32 | + unless permitted */ | ||
| 33 | + if(!data->set.allow_auth_to_other_hosts && (type != FOLLOW_FAKE)) { | ||
| 34 | + char *portnum; | ||
| 35 | + int port; | ||
| 36 | + bool clear = FALSE; | ||
| 37 | + | ||
| 38 | + if(data->set.use_port && data->state.allow_port) | ||
| 39 | + /* a custom port is used */ | ||
| 40 | + port = (int)data->set.use_port; | ||
| 41 | + else { | ||
| 42 | + uc = curl_url_get(data->state.uh, CURLUPART_PORT, &portnum, | ||
| 43 | + CURLU_DEFAULT_PORT); | ||
| 44 | + if(uc) { | ||
| 45 | + free(newurl); | ||
| 46 | + return Curl_uc_to_curlcode(uc); | ||
| 47 | + } | ||
| 48 | + port = atoi(portnum); | ||
| 49 | + free(portnum); | ||
| 50 | + } | ||
| 51 | + if(port != data->info.conn_remote_port) { | ||
| 52 | + infof(data, "Clear auth, redirects to port from %u to %u", | ||
| 53 | + data->info.conn_remote_port, port); | ||
| 54 | + clear = TRUE; | ||
| 55 | + } | ||
| 56 | + else { | ||
| 57 | + char *scheme; | ||
| 58 | + const struct Curl_handler *p; | ||
| 59 | + uc = curl_url_get(data->state.uh, CURLUPART_SCHEME, &scheme, 0); | ||
| 60 | + if(uc) { | ||
| 61 | + free(newurl); | ||
| 62 | + return Curl_uc_to_curlcode(uc); | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + p = Curl_builtin_scheme(scheme); | ||
| 66 | + if(p && (p->protocol != data->info.conn_protocol)) { | ||
| 67 | + infof(data, "Clear auth, redirects scheme from %s to %s", | ||
| 68 | + data->info.conn_scheme, scheme); | ||
| 69 | + clear = TRUE; | ||
| 70 | + } | ||
| 71 | + free(scheme); | ||
| 72 | + } | ||
| 73 | + if(clear) { | ||
| 74 | + Curl_safefree(data->set.str[STRING_USERNAME]); | ||
| 75 | + Curl_safefree(data->set.str[STRING_PASSWORD]); | ||
| 76 | + } | ||
| 77 | + } | ||
| 78 | } | ||
| 79 | |||
| 80 | if(type == FOLLOW_FAKE) { | ||
diff --git a/meta/recipes-support/curl/curl/CVE-2022-27774-3.patch b/meta/recipes-support/curl/curl/CVE-2022-27774-3.patch new file mode 100644 index 0000000000..a585f6a8fa --- /dev/null +++ b/meta/recipes-support/curl/curl/CVE-2022-27774-3.patch | |||
| @@ -0,0 +1,83 @@ | |||
| 1 | From 5dccf21ad49eed925e8f76b0cb844877239ce23d Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Daniel Stenberg <daniel@haxx.se> | ||
| 3 | Date: Mon, 25 Apr 2022 17:59:15 +0200 | ||
| 4 | Subject: [PATCH] openssl: don't leak the SRP credentials in redirects either | ||
| 5 | |||
| 6 | Follow-up to 620ea21410030 | ||
| 7 | |||
| 8 | Reported-by: Harry Sintonen | ||
| 9 | Closes #8751 | ||
| 10 | |||
| 11 | Upstream-Status: Backport [https://github.com/curl/curl/commit/139a54ed0a172adaaf1a78d6f4fff50b2c3f9e08] | ||
| 12 | Signed-off-by: Robert Joslyn <robert.joslyn@redrectangle.org> | ||
| 13 | --- | ||
| 14 | lib/http.c | 10 +++++----- | ||
| 15 | lib/http.h | 6 ++++++ | ||
| 16 | lib/vtls/openssl.c | 3 ++- | ||
| 17 | 3 files changed, 13 insertions(+), 6 deletions(-) | ||
| 18 | |||
| 19 | diff --git a/lib/http.c b/lib/http.c | ||
| 20 | index 8b16c09..5291c07 100644 | ||
| 21 | --- a/lib/http.c | ||
| 22 | +++ b/lib/http.c | ||
| 23 | @@ -732,10 +732,10 @@ output_auth_headers(struct connectdata *conn, | ||
| 24 | } | ||
| 25 | |||
| 26 | /* | ||
| 27 | - * allow_auth_to_host() tells if autentication, cookies or other "sensitive | ||
| 28 | - * data" can (still) be sent to this host. | ||
| 29 | + * Curl_allow_auth_to_host() tells if authentication, cookies or other | ||
| 30 | + * "sensitive data" can (still) be sent to this host. | ||
| 31 | */ | ||
| 32 | -static bool allow_auth_to_host(struct Curl_easy *data) | ||
| 33 | +bool Curl_allow_auth_to_host(struct Curl_easy *data) | ||
| 34 | { | ||
| 35 | struct connectdata *conn = data->conn; | ||
| 36 | return (!data->state.this_is_a_follow || | ||
| 37 | @@ -816,7 +816,7 @@ Curl_http_output_auth(struct connectdata *conn, | ||
| 38 | |||
| 39 | /* To prevent the user+password to get sent to other than the original host | ||
| 40 | due to a location-follow */ | ||
| 41 | - if(allow_auth_to_host(data) | ||
| 42 | + if(Curl_allow_auth_to_host(data) | ||
| 43 | || conn->bits.netrc | ||
| 44 | ) | ||
| 45 | result = output_auth_headers(conn, authhost, request, path, FALSE); | ||
| 46 | @@ -1891,7 +1891,7 @@ CURLcode Curl_add_custom_headers(struct connectdata *conn, | ||
| 47 | checkprefix("Cookie:", compare)) && | ||
| 48 | /* be careful of sending this potentially sensitive header to | ||
| 49 | other hosts */ | ||
| 50 | - !allow_auth_to_host(data)) | ||
| 51 | + !Curl_allow_auth_to_host(data)) | ||
| 52 | ; | ||
| 53 | else { | ||
| 54 | result = Curl_add_bufferf(&req_buffer, "%s\r\n", compare); | ||
| 55 | diff --git a/lib/http.h b/lib/http.h | ||
| 56 | index 4c1825f..4fbae1d 100644 | ||
| 57 | --- a/lib/http.h | ||
| 58 | +++ b/lib/http.h | ||
| 59 | @@ -273,4 +273,10 @@ Curl_http_output_auth(struct connectdata *conn, | ||
| 60 | bool proxytunnel); /* TRUE if this is the request setting | ||
| 61 | up the proxy tunnel */ | ||
| 62 | |||
| 63 | +/* | ||
| 64 | + * Curl_allow_auth_to_host() tells if authentication, cookies or other | ||
| 65 | + * "sensitive data" can (still) be sent to this host. | ||
| 66 | + */ | ||
| 67 | +bool Curl_allow_auth_to_host(struct Curl_easy *data); | ||
| 68 | + | ||
| 69 | #endif /* HEADER_CURL_HTTP_H */ | ||
| 70 | diff --git a/lib/vtls/openssl.c b/lib/vtls/openssl.c | ||
| 71 | index 006a8c8..a14cecc 100644 | ||
| 72 | --- a/lib/vtls/openssl.c | ||
| 73 | +++ b/lib/vtls/openssl.c | ||
| 74 | @@ -2739,7 +2739,8 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex) | ||
| 75 | #endif | ||
| 76 | |||
| 77 | #ifdef USE_TLS_SRP | ||
| 78 | - if(ssl_authtype == CURL_TLSAUTH_SRP) { | ||
| 79 | + if((ssl_authtype == CURL_TLSAUTH_SRP) && | ||
| 80 | + Curl_allow_auth_to_host(data)) { | ||
| 81 | char * const ssl_username = SSL_SET_OPTION(username); | ||
| 82 | |||
| 83 | infof(data, "Using TLS-SRP username: %s\n", ssl_username); | ||
diff --git a/meta/recipes-support/curl/curl/CVE-2022-27774-4.patch b/meta/recipes-support/curl/curl/CVE-2022-27774-4.patch new file mode 100644 index 0000000000..2258681cab --- /dev/null +++ b/meta/recipes-support/curl/curl/CVE-2022-27774-4.patch | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | From 7395752e2f7b87dc8c8f2a7137075e2da554aaea Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Daniel Stenberg <daniel@haxx.se> | ||
| 3 | Date: Tue, 26 Apr 2022 07:46:19 +0200 | ||
| 4 | Subject: [PATCH] gnutls: don't leak the SRP credentials in redirects | ||
| 5 | |||
| 6 | Follow-up to 620ea21410030 and 139a54ed0a172a | ||
| 7 | |||
| 8 | Reported-by: Harry Sintonen | ||
| 9 | Closes #8752 | ||
| 10 | |||
| 11 | Upstream-Status: Backport [https://github.com/curl/curl/commit/093531556203decd92d92bccd431edbe5561781c] | ||
| 12 | Signed-off-by: Robert Joslyn <robert.joslyn@redrectangle.org> | ||
| 13 | --- | ||
| 14 | lib/vtls/gtls.c | 6 +++--- | ||
| 15 | 1 file changed, 3 insertions(+), 3 deletions(-) | ||
| 16 | |||
| 17 | diff --git a/lib/vtls/gtls.c b/lib/vtls/gtls.c | ||
| 18 | index 8c05102..3d0758d 100644 | ||
| 19 | --- a/lib/vtls/gtls.c | ||
| 20 | +++ b/lib/vtls/gtls.c | ||
| 21 | @@ -581,11 +581,11 @@ gtls_connect_step1(struct connectdata *conn, | ||
| 22 | } | ||
| 23 | |||
| 24 | #ifdef USE_TLS_SRP | ||
| 25 | - if(SSL_SET_OPTION(authtype) == CURL_TLSAUTH_SRP) { | ||
| 26 | + if((SSL_SET_OPTION(authtype) == CURL_TLSAUTH_SRP) && | ||
| 27 | + Curl_allow_auth_to_host(data)) { | ||
| 28 | infof(data, "Using TLS-SRP username: %s\n", SSL_SET_OPTION(username)); | ||
| 29 | |||
| 30 | - rc = gnutls_srp_allocate_client_credentials( | ||
| 31 | - &BACKEND->srp_client_cred); | ||
| 32 | + rc = gnutls_srp_allocate_client_credentials(&BACKEND->srp_client_cred); | ||
| 33 | if(rc != GNUTLS_E_SUCCESS) { | ||
| 34 | failf(data, "gnutls_srp_allocate_client_cred() failed: %s", | ||
| 35 | gnutls_strerror(rc)); | ||
diff --git a/meta/recipes-support/curl/curl/CVE-2022-27781.patch b/meta/recipes-support/curl/curl/CVE-2022-27781.patch new file mode 100644 index 0000000000..ea1bc22928 --- /dev/null +++ b/meta/recipes-support/curl/curl/CVE-2022-27781.patch | |||
| @@ -0,0 +1,46 @@ | |||
| 1 | From 7a1f183039a6a6c9099a114f5e5c94777413c767 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Daniel Stenberg <daniel@haxx.se> | ||
| 3 | Date: Mon, 9 May 2022 10:07:15 +0200 | ||
| 4 | Subject: [PATCH] nss: return error if seemingly stuck in a cert loop | ||
| 5 | MIME-Version: 1.0 | ||
| 6 | Content-Type: text/plain; charset=UTF-8 | ||
| 7 | Content-Transfer-Encoding: 8bit | ||
| 8 | |||
| 9 | CVE-2022-27781 | ||
| 10 | |||
| 11 | Reported-by: Florian Kohnhäuser | ||
| 12 | Bug: https://curl.se/docs/CVE-2022-27781.html | ||
| 13 | Closes #8822 | ||
| 14 | |||
| 15 | Upstream-Status: Backport [https://github.com/curl/curl/commit/5c7da89d404bf59c8dd82a001119a16d18365917] | ||
| 16 | Signed-off-by: Robert Joslyn <robert.joslyn@redrectangle.org> | ||
| 17 | --- | ||
| 18 | lib/vtls/nss.c | 8 ++++++++ | ||
| 19 | 1 file changed, 8 insertions(+) | ||
| 20 | |||
| 21 | diff --git a/lib/vtls/nss.c b/lib/vtls/nss.c | ||
| 22 | index 375c78b..86102f7 100644 | ||
| 23 | --- a/lib/vtls/nss.c | ||
| 24 | +++ b/lib/vtls/nss.c | ||
| 25 | @@ -950,6 +950,9 @@ static void display_cert_info(struct Curl_easy *data, | ||
| 26 | PR_Free(common_name); | ||
| 27 | } | ||
| 28 | |||
| 29 | +/* A number of certs that will never occur in a real server handshake */ | ||
| 30 | +#define TOO_MANY_CERTS 300 | ||
| 31 | + | ||
| 32 | static CURLcode display_conn_info(struct connectdata *conn, PRFileDesc *sock) | ||
| 33 | { | ||
| 34 | CURLcode result = CURLE_OK; | ||
| 35 | @@ -986,6 +989,11 @@ static CURLcode display_conn_info(struct connectdata *conn, PRFileDesc *sock) | ||
| 36 | cert2 = CERT_FindCertIssuer(cert, now, certUsageSSLCA); | ||
| 37 | while(cert2) { | ||
| 38 | i++; | ||
| 39 | + if(i >= TOO_MANY_CERTS) { | ||
| 40 | + CERT_DestroyCertificate(cert2); | ||
| 41 | + failf(data, "certificate loop"); | ||
| 42 | + return CURLE_SSL_CERTPROBLEM; | ||
| 43 | + } | ||
| 44 | if(cert2->isRoot) { | ||
| 45 | CERT_DestroyCertificate(cert2); | ||
| 46 | break; | ||
diff --git a/meta/recipes-support/curl/curl/CVE-2022-27782-1.patch b/meta/recipes-support/curl/curl/CVE-2022-27782-1.patch new file mode 100644 index 0000000000..6b6d0e1938 --- /dev/null +++ b/meta/recipes-support/curl/curl/CVE-2022-27782-1.patch | |||
| @@ -0,0 +1,363 @@ | |||
| 1 | From 907a16c832d9ce0ffa7e9b2297548063095a7242 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Daniel Stenberg <daniel@haxx.se> | ||
| 3 | Date: Mon, 9 May 2022 23:13:53 +0200 | ||
| 4 | Subject: [PATCH] tls: check more TLS details for connection reuse | ||
| 5 | |||
| 6 | CVE-2022-27782 | ||
| 7 | |||
| 8 | Reported-by: Harry Sintonen | ||
| 9 | Bug: https://curl.se/docs/CVE-2022-27782.html | ||
| 10 | Closes #8825 | ||
| 11 | |||
| 12 | Upstream-Status: Backport [https://github.com/curl/curl/commit/f18af4f874cecab82a9797e8c7541e0990c7a64c] | ||
| 13 | Signed-off-by: Robert Joslyn <robert.joslyn@redrectangle.org> | ||
| 14 | --- | ||
| 15 | lib/setopt.c | 29 +++++++++++++++++------------ | ||
| 16 | lib/url.c | 17 ++++++++++------- | ||
| 17 | lib/urldata.h | 13 +++++++------ | ||
| 18 | lib/vtls/gtls.c | 30 ++++++++++++++++-------------- | ||
| 19 | lib/vtls/mbedtls.c | 2 +- | ||
| 20 | lib/vtls/nss.c | 6 +++--- | ||
| 21 | lib/vtls/openssl.c | 10 +++++----- | ||
| 22 | lib/vtls/vtls.c | 1 + | ||
| 23 | 8 files changed, 60 insertions(+), 48 deletions(-) | ||
| 24 | |||
| 25 | diff --git a/lib/setopt.c b/lib/setopt.c | ||
| 26 | index 4648c87..bebb2e4 100644 | ||
| 27 | --- a/lib/setopt.c | ||
| 28 | +++ b/lib/setopt.c | ||
| 29 | @@ -2130,6 +2130,7 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param) | ||
| 30 | |||
| 31 | case CURLOPT_SSL_OPTIONS: | ||
| 32 | arg = va_arg(param, long); | ||
| 33 | + data->set.ssl.primary.ssl_options = (unsigned char)(arg & 0xff); | ||
| 34 | data->set.ssl.enable_beast = | ||
| 35 | (bool)((arg&CURLSSLOPT_ALLOW_BEAST) ? TRUE : FALSE); | ||
| 36 | data->set.ssl.no_revoke = !!(arg & CURLSSLOPT_NO_REVOKE); | ||
| 37 | @@ -2139,6 +2140,7 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param) | ||
| 38 | #ifndef CURL_DISABLE_PROXY | ||
| 39 | case CURLOPT_PROXY_SSL_OPTIONS: | ||
| 40 | arg = va_arg(param, long); | ||
| 41 | + data->set.proxy_ssl.primary.ssl_options = (unsigned char)(arg & 0xff); | ||
| 42 | data->set.proxy_ssl.enable_beast = | ||
| 43 | (bool)((arg&CURLSSLOPT_ALLOW_BEAST) ? TRUE : FALSE); | ||
| 44 | data->set.proxy_ssl.no_revoke = !!(arg & CURLSSLOPT_NO_REVOKE); | ||
| 45 | @@ -2541,44 +2543,47 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param) | ||
| 46 | case CURLOPT_TLSAUTH_USERNAME: | ||
| 47 | result = Curl_setstropt(&data->set.str[STRING_TLSAUTH_USERNAME_ORIG], | ||
| 48 | va_arg(param, char *)); | ||
| 49 | - if(data->set.str[STRING_TLSAUTH_USERNAME_ORIG] && !data->set.ssl.authtype) | ||
| 50 | - data->set.ssl.authtype = CURL_TLSAUTH_SRP; /* default to SRP */ | ||
| 51 | + if(data->set.str[STRING_TLSAUTH_USERNAME_ORIG] && | ||
| 52 | + !data->set.ssl.primary.authtype) | ||
| 53 | + data->set.ssl.primary.authtype = CURL_TLSAUTH_SRP; /* default to SRP */ | ||
| 54 | break; | ||
| 55 | case CURLOPT_PROXY_TLSAUTH_USERNAME: | ||
| 56 | result = Curl_setstropt(&data->set.str[STRING_TLSAUTH_USERNAME_PROXY], | ||
| 57 | va_arg(param, char *)); | ||
| 58 | if(data->set.str[STRING_TLSAUTH_USERNAME_PROXY] && | ||
| 59 | - !data->set.proxy_ssl.authtype) | ||
| 60 | - data->set.proxy_ssl.authtype = CURL_TLSAUTH_SRP; /* default to SRP */ | ||
| 61 | + !data->set.proxy_ssl.primary.authtype) | ||
| 62 | + data->set.proxy_ssl.primary.authtype = CURL_TLSAUTH_SRP; /* default to | ||
| 63 | + SRP */ | ||
| 64 | break; | ||
| 65 | case CURLOPT_TLSAUTH_PASSWORD: | ||
| 66 | result = Curl_setstropt(&data->set.str[STRING_TLSAUTH_PASSWORD_ORIG], | ||
| 67 | va_arg(param, char *)); | ||
| 68 | - if(data->set.str[STRING_TLSAUTH_USERNAME_ORIG] && !data->set.ssl.authtype) | ||
| 69 | - data->set.ssl.authtype = CURL_TLSAUTH_SRP; /* default to SRP */ | ||
| 70 | + if(data->set.str[STRING_TLSAUTH_USERNAME_ORIG] && | ||
| 71 | + !data->set.ssl.primary.authtype) | ||
| 72 | + data->set.ssl.primary.authtype = CURL_TLSAUTH_SRP; /* default to SRP */ | ||
| 73 | break; | ||
| 74 | case CURLOPT_PROXY_TLSAUTH_PASSWORD: | ||
| 75 | result = Curl_setstropt(&data->set.str[STRING_TLSAUTH_PASSWORD_PROXY], | ||
| 76 | va_arg(param, char *)); | ||
| 77 | if(data->set.str[STRING_TLSAUTH_USERNAME_PROXY] && | ||
| 78 | - !data->set.proxy_ssl.authtype) | ||
| 79 | - data->set.proxy_ssl.authtype = CURL_TLSAUTH_SRP; /* default to SRP */ | ||
| 80 | + !data->set.proxy_ssl.primary.authtype) | ||
| 81 | + data->set.proxy_ssl.primary.authtype = CURL_TLSAUTH_SRP; /* default */ | ||
| 82 | break; | ||
| 83 | case CURLOPT_TLSAUTH_TYPE: | ||
| 84 | argptr = va_arg(param, char *); | ||
| 85 | if(!argptr || | ||
| 86 | strncasecompare(argptr, "SRP", strlen("SRP"))) | ||
| 87 | - data->set.ssl.authtype = CURL_TLSAUTH_SRP; | ||
| 88 | + data->set.ssl.primary.authtype = CURL_TLSAUTH_SRP; | ||
| 89 | else | ||
| 90 | - data->set.ssl.authtype = CURL_TLSAUTH_NONE; | ||
| 91 | + data->set.ssl.primary.authtype = CURL_TLSAUTH_NONE; | ||
| 92 | break; | ||
| 93 | case CURLOPT_PROXY_TLSAUTH_TYPE: | ||
| 94 | argptr = va_arg(param, char *); | ||
| 95 | if(!argptr || | ||
| 96 | strncasecompare(argptr, "SRP", strlen("SRP"))) | ||
| 97 | - data->set.proxy_ssl.authtype = CURL_TLSAUTH_SRP; | ||
| 98 | + data->set.proxy_ssl.primary.authtype = CURL_TLSAUTH_SRP; | ||
| 99 | else | ||
| 100 | - data->set.proxy_ssl.authtype = CURL_TLSAUTH_NONE; | ||
| 101 | + data->set.proxy_ssl.primary.authtype = CURL_TLSAUTH_NONE; | ||
| 102 | break; | ||
| 103 | #endif | ||
| 104 | #ifdef USE_ARES | ||
| 105 | diff --git a/lib/url.c b/lib/url.c | ||
| 106 | index efa3dc7..6518be9 100644 | ||
| 107 | --- a/lib/url.c | ||
| 108 | +++ b/lib/url.c | ||
| 109 | @@ -482,7 +482,7 @@ CURLcode Curl_init_userdefined(struct Curl_easy *data) | ||
| 110 | set->ssl.primary.verifypeer = TRUE; | ||
| 111 | set->ssl.primary.verifyhost = TRUE; | ||
| 112 | #ifdef USE_TLS_SRP | ||
| 113 | - set->ssl.authtype = CURL_TLSAUTH_NONE; | ||
| 114 | + set->ssl.primary.authtype = CURL_TLSAUTH_NONE; | ||
| 115 | #endif | ||
| 116 | set->ssh_auth_types = CURLSSH_AUTH_DEFAULT; /* defaults to any auth | ||
| 117 | type */ | ||
| 118 | @@ -3594,8 +3594,9 @@ static CURLcode create_conn(struct Curl_easy *data, | ||
| 119 | data->set.proxy_ssl.primary.pinned_key = | ||
| 120 | data->set.str[STRING_SSL_PINNEDPUBLICKEY_PROXY]; | ||
| 121 | |||
| 122 | - data->set.ssl.CRLfile = data->set.str[STRING_SSL_CRLFILE_ORIG]; | ||
| 123 | - data->set.proxy_ssl.CRLfile = data->set.str[STRING_SSL_CRLFILE_PROXY]; | ||
| 124 | + data->set.ssl.primary.CRLfile = data->set.str[STRING_SSL_CRLFILE_ORIG]; | ||
| 125 | + data->set.proxy_ssl.primary.CRLfile = | ||
| 126 | + data->set.str[STRING_SSL_CRLFILE_PROXY]; | ||
| 127 | data->set.ssl.cert = data->set.str[STRING_CERT_ORIG]; | ||
| 128 | data->set.proxy_ssl.cert = data->set.str[STRING_CERT_PROXY]; | ||
| 129 | data->set.ssl.cert_type = data->set.str[STRING_CERT_TYPE_ORIG]; | ||
| 130 | @@ -3609,10 +3610,12 @@ static CURLcode create_conn(struct Curl_easy *data, | ||
| 131 | data->set.ssl.primary.clientcert = data->set.str[STRING_CERT_ORIG]; | ||
| 132 | data->set.proxy_ssl.primary.clientcert = data->set.str[STRING_CERT_PROXY]; | ||
| 133 | #ifdef USE_TLS_SRP | ||
| 134 | - data->set.ssl.username = data->set.str[STRING_TLSAUTH_USERNAME_ORIG]; | ||
| 135 | - data->set.proxy_ssl.username = data->set.str[STRING_TLSAUTH_USERNAME_PROXY]; | ||
| 136 | - data->set.ssl.password = data->set.str[STRING_TLSAUTH_PASSWORD_ORIG]; | ||
| 137 | - data->set.proxy_ssl.password = data->set.str[STRING_TLSAUTH_PASSWORD_PROXY]; | ||
| 138 | + data->set.ssl.primary.username = data->set.str[STRING_TLSAUTH_USERNAME_ORIG]; | ||
| 139 | + data->set.proxy_ssl.primary.username = | ||
| 140 | + data->set.str[STRING_TLSAUTH_USERNAME_PROXY]; | ||
| 141 | + data->set.ssl.primary.password = data->set.str[STRING_TLSAUTH_PASSWORD_ORIG]; | ||
| 142 | + data->set.proxy_ssl.primary.password = | ||
| 143 | + data->set.str[STRING_TLSAUTH_PASSWORD_PROXY]; | ||
| 144 | #endif | ||
| 145 | |||
| 146 | if(!Curl_clone_primary_ssl_config(&data->set.ssl.primary, | ||
| 147 | diff --git a/lib/urldata.h b/lib/urldata.h | ||
| 148 | index ab1b267..ad0ef8f 100644 | ||
| 149 | --- a/lib/urldata.h | ||
| 150 | +++ b/lib/urldata.h | ||
| 151 | @@ -231,6 +231,13 @@ struct ssl_primary_config { | ||
| 152 | char *cipher_list; /* list of ciphers to use */ | ||
| 153 | char *cipher_list13; /* list of TLS 1.3 cipher suites to use */ | ||
| 154 | char *pinned_key; | ||
| 155 | + char *CRLfile; /* CRL to check certificate revocation */ | ||
| 156 | + #ifdef USE_TLS_SRP | ||
| 157 | + char *username; /* TLS username (for, e.g., SRP) */ | ||
| 158 | + char *password; /* TLS password (for, e.g., SRP) */ | ||
| 159 | + enum CURL_TLSAUTH authtype; /* TLS authentication type (default SRP) */ | ||
| 160 | + #endif | ||
| 161 | + unsigned char ssl_options; /* the CURLOPT_SSL_OPTIONS bitmask */ | ||
| 162 | BIT(verifypeer); /* set TRUE if this is desired */ | ||
| 163 | BIT(verifyhost); /* set TRUE if CN/SAN must match hostname */ | ||
| 164 | BIT(verifystatus); /* set TRUE if certificate status must be checked */ | ||
| 165 | @@ -240,7 +247,6 @@ struct ssl_primary_config { | ||
| 166 | struct ssl_config_data { | ||
| 167 | struct ssl_primary_config primary; | ||
| 168 | long certverifyresult; /* result from the certificate verification */ | ||
| 169 | - char *CRLfile; /* CRL to check certificate revocation */ | ||
| 170 | curl_ssl_ctx_callback fsslctx; /* function to initialize ssl ctx */ | ||
| 171 | void *fsslctxp; /* parameter for call back */ | ||
| 172 | char *cert; /* client certificate file name */ | ||
| 173 | @@ -248,11 +254,6 @@ struct ssl_config_data { | ||
| 174 | char *key; /* private key file name */ | ||
| 175 | char *key_type; /* format for private key (default: PEM) */ | ||
| 176 | char *key_passwd; /* plain text private key password */ | ||
| 177 | -#ifdef USE_TLS_SRP | ||
| 178 | - char *username; /* TLS username (for, e.g., SRP) */ | ||
| 179 | - char *password; /* TLS password (for, e.g., SRP) */ | ||
| 180 | - enum CURL_TLSAUTH authtype; /* TLS authentication type (default SRP) */ | ||
| 181 | -#endif | ||
| 182 | BIT(certinfo); /* gather lots of certificate info */ | ||
| 183 | BIT(falsestart); | ||
| 184 | BIT(enable_beast); /* allow this flaw for interoperability's sake*/ | ||
| 185 | diff --git a/lib/vtls/gtls.c b/lib/vtls/gtls.c | ||
| 186 | index 3d0758d..92c301c 100644 | ||
| 187 | --- a/lib/vtls/gtls.c | ||
| 188 | +++ b/lib/vtls/gtls.c | ||
| 189 | @@ -581,9 +581,10 @@ gtls_connect_step1(struct connectdata *conn, | ||
| 190 | } | ||
| 191 | |||
| 192 | #ifdef USE_TLS_SRP | ||
| 193 | - if((SSL_SET_OPTION(authtype) == CURL_TLSAUTH_SRP) && | ||
| 194 | + if((SSL_SET_OPTION(primary.authtype) == CURL_TLSAUTH_SRP) && | ||
| 195 | Curl_allow_auth_to_host(data)) { | ||
| 196 | - infof(data, "Using TLS-SRP username: %s\n", SSL_SET_OPTION(username)); | ||
| 197 | + infof(data, "Using TLS-SRP username: %s\n", | ||
| 198 | + SSL_SET_OPTION(primary.username)); | ||
| 199 | |||
| 200 | rc = gnutls_srp_allocate_client_credentials(&BACKEND->srp_client_cred); | ||
| 201 | if(rc != GNUTLS_E_SUCCESS) { | ||
| 202 | @@ -593,8 +594,8 @@ gtls_connect_step1(struct connectdata *conn, | ||
| 203 | } | ||
| 204 | |||
| 205 | rc = gnutls_srp_set_client_credentials(BACKEND->srp_client_cred, | ||
| 206 | - SSL_SET_OPTION(username), | ||
| 207 | - SSL_SET_OPTION(password)); | ||
| 208 | + SSL_SET_OPTION(primary.username), | ||
| 209 | + SSL_SET_OPTION(primary.password)); | ||
| 210 | if(rc != GNUTLS_E_SUCCESS) { | ||
| 211 | failf(data, "gnutls_srp_set_client_cred() failed: %s", | ||
| 212 | gnutls_strerror(rc)); | ||
| 213 | @@ -648,19 +649,19 @@ gtls_connect_step1(struct connectdata *conn, | ||
| 214 | } | ||
| 215 | #endif | ||
| 216 | |||
| 217 | - if(SSL_SET_OPTION(CRLfile)) { | ||
| 218 | + if(SSL_SET_OPTION(primary.CRLfile)) { | ||
| 219 | /* set the CRL list file */ | ||
| 220 | rc = gnutls_certificate_set_x509_crl_file(BACKEND->cred, | ||
| 221 | - SSL_SET_OPTION(CRLfile), | ||
| 222 | + SSL_SET_OPTION(primary.CRLfile), | ||
| 223 | GNUTLS_X509_FMT_PEM); | ||
| 224 | if(rc < 0) { | ||
| 225 | failf(data, "error reading crl file %s (%s)", | ||
| 226 | - SSL_SET_OPTION(CRLfile), gnutls_strerror(rc)); | ||
| 227 | + SSL_SET_OPTION(primary.CRLfile), gnutls_strerror(rc)); | ||
| 228 | return CURLE_SSL_CRL_BADFILE; | ||
| 229 | } | ||
| 230 | else | ||
| 231 | infof(data, "found %d CRL in %s\n", | ||
| 232 | - rc, SSL_SET_OPTION(CRLfile)); | ||
| 233 | + rc, SSL_SET_OPTION(primary.CRLfile)); | ||
| 234 | } | ||
| 235 | |||
| 236 | /* Initialize TLS session as a client */ | ||
| 237 | @@ -879,7 +880,7 @@ gtls_connect_step1(struct connectdata *conn, | ||
| 238 | |||
| 239 | #ifdef USE_TLS_SRP | ||
| 240 | /* put the credentials to the current session */ | ||
| 241 | - if(SSL_SET_OPTION(authtype) == CURL_TLSAUTH_SRP) { | ||
| 242 | + if(SSL_SET_OPTION(primary.authtype) == CURL_TLSAUTH_SRP) { | ||
| 243 | rc = gnutls_credentials_set(session, GNUTLS_CRD_SRP, | ||
| 244 | BACKEND->srp_client_cred); | ||
| 245 | if(rc != GNUTLS_E_SUCCESS) { | ||
| 246 | @@ -1061,8 +1062,8 @@ gtls_connect_step3(struct connectdata *conn, | ||
| 247 | SSL_CONN_CONFIG(verifyhost) || | ||
| 248 | SSL_CONN_CONFIG(issuercert)) { | ||
| 249 | #ifdef USE_TLS_SRP | ||
| 250 | - if(SSL_SET_OPTION(authtype) == CURL_TLSAUTH_SRP | ||
| 251 | - && SSL_SET_OPTION(username) != NULL | ||
| 252 | + if(SSL_SET_OPTION(primary.authtype) == CURL_TLSAUTH_SRP | ||
| 253 | + && SSL_SET_OPTION(primary.username) != NULL | ||
| 254 | && !SSL_CONN_CONFIG(verifypeer) | ||
| 255 | && gnutls_cipher_get(session)) { | ||
| 256 | /* no peer cert, but auth is ok if we have SRP user and cipher and no | ||
| 257 | @@ -1116,7 +1117,8 @@ gtls_connect_step3(struct connectdata *conn, | ||
| 258 | failf(data, "server certificate verification failed. CAfile: %s " | ||
| 259 | "CRLfile: %s", SSL_CONN_CONFIG(CAfile) ? SSL_CONN_CONFIG(CAfile): | ||
| 260 | "none", | ||
| 261 | - SSL_SET_OPTION(CRLfile)?SSL_SET_OPTION(CRLfile):"none"); | ||
| 262 | + SSL_SET_OPTION(primary.CRLfile) ? | ||
| 263 | + SSL_SET_OPTION(primary.CRLfile) : "none"); | ||
| 264 | return CURLE_PEER_FAILED_VERIFICATION; | ||
| 265 | } | ||
| 266 | else | ||
| 267 | @@ -1703,8 +1705,8 @@ static int Curl_gtls_shutdown(struct connectdata *conn, int sockindex) | ||
| 268 | gnutls_certificate_free_credentials(BACKEND->cred); | ||
| 269 | |||
| 270 | #ifdef USE_TLS_SRP | ||
| 271 | - if(SSL_SET_OPTION(authtype) == CURL_TLSAUTH_SRP | ||
| 272 | - && SSL_SET_OPTION(username) != NULL) | ||
| 273 | + if(SSL_SET_OPTION(primary.authtype) == CURL_TLSAUTH_SRP | ||
| 274 | + && SSL_SET_OPTION(primary.username) != NULL) | ||
| 275 | gnutls_srp_free_client_credentials(BACKEND->srp_client_cred); | ||
| 276 | #endif | ||
| 277 | |||
| 278 | diff --git a/lib/vtls/mbedtls.c b/lib/vtls/mbedtls.c | ||
| 279 | index 19df847..62d2b00 100644 | ||
| 280 | --- a/lib/vtls/mbedtls.c | ||
| 281 | +++ b/lib/vtls/mbedtls.c | ||
| 282 | @@ -245,7 +245,7 @@ mbed_connect_step1(struct connectdata *conn, | ||
| 283 | const bool verifypeer = SSL_CONN_CONFIG(verifypeer); | ||
| 284 | const char * const ssl_capath = SSL_CONN_CONFIG(CApath); | ||
| 285 | char * const ssl_cert = SSL_SET_OPTION(cert); | ||
| 286 | - const char * const ssl_crlfile = SSL_SET_OPTION(CRLfile); | ||
| 287 | + const char * const ssl_crlfile = SSL_SET_OPTION(primary.CRLfile); | ||
| 288 | const char * const hostname = SSL_IS_PROXY() ? conn->http_proxy.host.name : | ||
| 289 | conn->host.name; | ||
| 290 | const long int port = SSL_IS_PROXY() ? conn->port : conn->remote_port; | ||
| 291 | diff --git a/lib/vtls/nss.c b/lib/vtls/nss.c | ||
| 292 | index 86102f7..62fd7a2 100644 | ||
| 293 | --- a/lib/vtls/nss.c | ||
| 294 | +++ b/lib/vtls/nss.c | ||
| 295 | @@ -1955,13 +1955,13 @@ static CURLcode nss_setup_connect(struct connectdata *conn, int sockindex) | ||
| 296 | } | ||
| 297 | } | ||
| 298 | |||
| 299 | - if(SSL_SET_OPTION(CRLfile)) { | ||
| 300 | - const CURLcode rv = nss_load_crl(SSL_SET_OPTION(CRLfile)); | ||
| 301 | + if(SSL_SET_OPTION(primary.CRLfile)) { | ||
| 302 | + const CURLcode rv = nss_load_crl(SSL_SET_OPTION(primary.CRLfile)); | ||
| 303 | if(rv) { | ||
| 304 | result = rv; | ||
| 305 | goto error; | ||
| 306 | } | ||
| 307 | - infof(data, " CRLfile: %s\n", SSL_SET_OPTION(CRLfile)); | ||
| 308 | + infof(data, " CRLfile: %s\n", SSL_SET_OPTION(primary.CRLfile)); | ||
| 309 | } | ||
| 310 | |||
| 311 | if(SSL_SET_OPTION(cert)) { | ||
| 312 | diff --git a/lib/vtls/openssl.c b/lib/vtls/openssl.c | ||
| 313 | index a14cecc..ec5a8f5 100644 | ||
| 314 | --- a/lib/vtls/openssl.c | ||
| 315 | +++ b/lib/vtls/openssl.c | ||
| 316 | @@ -2454,14 +2454,14 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex) | ||
| 317 | &data->set.proxy_ssl.certverifyresult : &data->set.ssl.certverifyresult; | ||
| 318 | const long int ssl_version = SSL_CONN_CONFIG(version); | ||
| 319 | #ifdef USE_TLS_SRP | ||
| 320 | - const enum CURL_TLSAUTH ssl_authtype = SSL_SET_OPTION(authtype); | ||
| 321 | + const enum CURL_TLSAUTH ssl_authtype = SSL_SET_OPTION(primary.authtype); | ||
| 322 | #endif | ||
| 323 | char * const ssl_cert = SSL_SET_OPTION(cert); | ||
| 324 | const char * const ssl_cert_type = SSL_SET_OPTION(cert_type); | ||
| 325 | const char * const ssl_cafile = SSL_CONN_CONFIG(CAfile); | ||
| 326 | const char * const ssl_capath = SSL_CONN_CONFIG(CApath); | ||
| 327 | const bool verifypeer = SSL_CONN_CONFIG(verifypeer); | ||
| 328 | - const char * const ssl_crlfile = SSL_SET_OPTION(CRLfile); | ||
| 329 | + const char * const ssl_crlfile = SSL_SET_OPTION(primary.CRLfile); | ||
| 330 | char error_buffer[256]; | ||
| 331 | |||
| 332 | DEBUGASSERT(ssl_connect_1 == connssl->connecting_state); | ||
| 333 | @@ -2741,15 +2741,15 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex) | ||
| 334 | #ifdef USE_TLS_SRP | ||
| 335 | if((ssl_authtype == CURL_TLSAUTH_SRP) && | ||
| 336 | Curl_allow_auth_to_host(data)) { | ||
| 337 | - char * const ssl_username = SSL_SET_OPTION(username); | ||
| 338 | - | ||
| 339 | + char * const ssl_username = SSL_SET_OPTION(primary.username); | ||
| 340 | + char * const ssl_password = SSL_SET_OPTION(primary.password); | ||
| 341 | infof(data, "Using TLS-SRP username: %s\n", ssl_username); | ||
| 342 | |||
| 343 | if(!SSL_CTX_set_srp_username(BACKEND->ctx, ssl_username)) { | ||
| 344 | failf(data, "Unable to set SRP user name"); | ||
| 345 | return CURLE_BAD_FUNCTION_ARGUMENT; | ||
| 346 | } | ||
| 347 | - if(!SSL_CTX_set_srp_password(BACKEND->ctx, SSL_SET_OPTION(password))) { | ||
| 348 | + if(!SSL_CTX_set_srp_password(BACKEND->ctx, ssl_password)) { | ||
| 349 | failf(data, "failed setting SRP password"); | ||
| 350 | return CURLE_BAD_FUNCTION_ARGUMENT; | ||
| 351 | } | ||
| 352 | diff --git a/lib/vtls/vtls.c b/lib/vtls/vtls.c | ||
| 353 | index e38f74e..e8cb70f 100644 | ||
| 354 | --- a/lib/vtls/vtls.c | ||
| 355 | +++ b/lib/vtls/vtls.c | ||
| 356 | @@ -89,6 +89,7 @@ Curl_ssl_config_matches(struct ssl_primary_config* data, | ||
| 357 | { | ||
| 358 | if((data->version == needle->version) && | ||
| 359 | (data->version_max == needle->version_max) && | ||
| 360 | + (data->ssl_options == needle->ssl_options) && | ||
| 361 | (data->verifypeer == needle->verifypeer) && | ||
| 362 | (data->verifyhost == needle->verifyhost) && | ||
| 363 | (data->verifystatus == needle->verifystatus) && | ||
diff --git a/meta/recipes-support/curl/curl/CVE-2022-27782-2.patch b/meta/recipes-support/curl/curl/CVE-2022-27782-2.patch new file mode 100644 index 0000000000..3d56025210 --- /dev/null +++ b/meta/recipes-support/curl/curl/CVE-2022-27782-2.patch | |||
| @@ -0,0 +1,71 @@ | |||
| 1 | From 0a115a8903dffc7f723d1d4d71fb821d69eb8761 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Daniel Stenberg <daniel@haxx.se> | ||
| 3 | Date: Mon, 9 May 2022 23:13:53 +0200 | ||
| 4 | Subject: [PATCH] url: check SSH config match on connection reuse | ||
| 5 | |||
| 6 | CVE-2022-27782 | ||
| 7 | |||
| 8 | Reported-by: Harry Sintonen | ||
| 9 | Bug: https://curl.se/docs/CVE-2022-27782.html | ||
| 10 | Closes #8825 | ||
| 11 | |||
| 12 | Upstream-Status: Backport [https://github.com/curl/curl/commit/1645e9b44505abd5cbaf65da5282c3f33b5924a5] | ||
| 13 | Signed-off-by: Robert Joslyn <robert.joslyn@redrectangle.org> | ||
| 14 | --- | ||
| 15 | lib/url.c | 11 +++++++++++ | ||
| 16 | lib/vssh/ssh.h | 6 +++--- | ||
| 17 | 2 files changed, 14 insertions(+), 3 deletions(-) | ||
| 18 | |||
| 19 | diff --git a/lib/url.c b/lib/url.c | ||
| 20 | index 6518be9..8da0245 100644 | ||
| 21 | --- a/lib/url.c | ||
| 22 | +++ b/lib/url.c | ||
| 23 | @@ -1027,6 +1027,12 @@ static void prune_dead_connections(struct Curl_easy *data) | ||
| 24 | } | ||
| 25 | } | ||
| 26 | |||
| 27 | +static bool ssh_config_matches(struct connectdata *one, | ||
| 28 | + struct connectdata *two) | ||
| 29 | +{ | ||
| 30 | + return (Curl_safecmp(one->proto.sshc.rsa, two->proto.sshc.rsa) && | ||
| 31 | + Curl_safecmp(one->proto.sshc.rsa_pub, two->proto.sshc.rsa_pub)); | ||
| 32 | +} | ||
| 33 | /* | ||
| 34 | * Given one filled in connection struct (named needle), this function should | ||
| 35 | * detect if there already is one that has all the significant details | ||
| 36 | @@ -1260,6 +1266,11 @@ ConnectionExists(struct Curl_easy *data, | ||
| 37 | } | ||
| 38 | } | ||
| 39 | |||
| 40 | + if(get_protocol_family(needle->handler->protocol) == PROTO_FAMILY_SSH) { | ||
| 41 | + if(!ssh_config_matches(needle, check)) | ||
| 42 | + continue; | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | if(!needle->bits.httpproxy || (needle->handler->flags&PROTOPT_SSL) || | ||
| 46 | needle->bits.tunnel_proxy) { | ||
| 47 | /* The requested connection does not use a HTTP proxy or it uses SSL or | ||
| 48 | diff --git a/lib/vssh/ssh.h b/lib/vssh/ssh.h | ||
| 49 | index 0d4ee52..8f2632e 100644 | ||
| 50 | --- a/lib/vssh/ssh.h | ||
| 51 | +++ b/lib/vssh/ssh.h | ||
| 52 | @@ -7,7 +7,7 @@ | ||
| 53 | * | (__| |_| | _ <| |___ | ||
| 54 | * \___|\___/|_| \_\_____| | ||
| 55 | * | ||
| 56 | - * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al. | ||
| 57 | + * Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al. | ||
| 58 | * | ||
| 59 | * This software is licensed as described in the file COPYING, which | ||
| 60 | * you should have received as part of this distribution. The terms | ||
| 61 | @@ -120,8 +120,8 @@ struct ssh_conn { | ||
| 62 | |||
| 63 | /* common */ | ||
| 64 | const char *passphrase; /* pass-phrase to use */ | ||
| 65 | - char *rsa_pub; /* path name */ | ||
| 66 | - char *rsa; /* path name */ | ||
| 67 | + char *rsa_pub; /* strdup'ed public key file */ | ||
| 68 | + char *rsa; /* strdup'ed private key file */ | ||
| 69 | bool authed; /* the connection has been authenticated fine */ | ||
| 70 | sshstate state; /* always use ssh.c:state() to change state! */ | ||
| 71 | sshstate nextstate; /* the state to goto after stopping */ | ||
diff --git a/meta/recipes-support/curl/curl_7.69.1.bb b/meta/recipes-support/curl/curl_7.69.1.bb index e850376ff8..b53b00cc38 100644 --- a/meta/recipes-support/curl/curl_7.69.1.bb +++ b/meta/recipes-support/curl/curl_7.69.1.bb | |||
| @@ -28,6 +28,13 @@ SRC_URI = "https://curl.haxx.se/download/curl-${PV}.tar.bz2 \ | |||
| 28 | file://CVE-2022-27776.patch \ | 28 | file://CVE-2022-27776.patch \ |
| 29 | file://CVE-2022-27775.patch \ | 29 | file://CVE-2022-27775.patch \ |
| 30 | file://CVE-2022-22576.patch \ | 30 | file://CVE-2022-22576.patch \ |
| 31 | file://CVE-2022-27774-1.patch \ | ||
| 32 | file://CVE-2022-27774-2.patch \ | ||
| 33 | file://CVE-2022-27774-3.patch \ | ||
| 34 | file://CVE-2022-27774-4.patch \ | ||
| 35 | file://CVE-2022-27781.patch \ | ||
| 36 | file://CVE-2022-27782-1.patch \ | ||
| 37 | file://CVE-2022-27782-2.patch \ | ||
| 31 | " | 38 | " |
| 32 | 39 | ||
| 33 | SRC_URI[md5sum] = "ec5fc263f898a3dfef08e805f1ecca42" | 40 | SRC_URI[md5sum] = "ec5fc263f898a3dfef08e805f1ecca42" |
