public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/curl] curl-v8.23.0-3: TLS: check connection for SSL use, not handler
@ 2026-11-03 12:39 Jan Macku
0 siblings, 0 replies; only message in thread
From: Jan Macku @ 2026-11-03 12:39 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/curl
Branch : curl-v8.23.0-3
Commit : dbdb66e32ef7a74430edc9f27487a980b933f36b
Author : Jan Macku <jamacku@redhat.com>
Date : 2025-01-31T15:01:32+01:00
Stats : +234/-1 in 2 file(s)
URL : https://src.fedoraproject.org/rpms/curl/c/dbdb66e32ef7a74430edc9f27487a980b933f36b?branch=curl-v8.23.0-3
Log:
TLS: check connection for SSL use, not handler
Resolves: #2324130
---
diff --git a/0002-curl-8.11.1-TLS-check-connection-for-SSL-use-not-handler.patch b/0002-curl-8.11.1-TLS-check-connection-for-SSL-use-not-handler.patch
new file mode 100644
index 0000000..9000c48
--- /dev/null
+++ b/0002-curl-8.11.1-TLS-check-connection-for-SSL-use-not-handler.patch
@@ -0,0 +1,227 @@
+From b876aeb3f5d5c6539102f0575c0ec1d116388337 Mon Sep 17 00:00:00 2001
+From: Stefan Eissing <stefan@eissing.org>
+Date: Fri, 17 Jan 2025 11:57:00 +0100
+Subject: [PATCH] TLS: check connection for SSL use, not handler
+
+Protocol handler option PROTOPT_SSL is used to setup a connection
+filters. Once that is done, used `Curl_conn_is_ssl()` to check if
+a connection uses SSL.
+
+There may be other reasons to add SSL to a connection, e.g. starttls.
+
+Closes #16034
+
+(cherry picked from commit 25b445e4796bcbf9f842de686a8c384b30f6c2a2)
+---
+ lib/cf-socket.c | 2 +-
+ lib/ftp.c | 2 +-
+ lib/http.c | 8 ++++----
+ lib/http_negotiate.c | 3 ++-
+ lib/imap.c | 2 +-
+ lib/ldap.c | 3 ++-
+ lib/openldap.c | 2 +-
+ lib/pop3.c | 2 +-
+ lib/smb.c | 2 +-
+ lib/smtp.c | 2 +-
+ lib/url.c | 12 ++++++------
+ 11 files changed, 21 insertions(+), 19 deletions(-)
+
+diff --git a/lib/cf-socket.c b/lib/cf-socket.c
+index 497a3b965..de0c8a3ba 100644
+--- a/lib/cf-socket.c
++++ b/lib/cf-socket.c
+@@ -1282,7 +1282,7 @@ static int do_connect(struct Curl_cfilter *cf, struct Curl_easy *data,
+
+ rc = connect(ctx->sock, &ctx->addr.curl_sa_addr, ctx->addr.addrlen);
+ #elif defined(MSG_FASTOPEN) /* old Linux */
+- if(cf->conn->given->flags & PROTOPT_SSL)
++ if(Curl_conn_is_ssl(cf->conn, cf->sockindex))
+ rc = connect(ctx->sock, &ctx->addr.curl_sa_addr, ctx->addr.addrlen);
+ else
+ rc = 0; /* Do nothing */
+diff --git a/lib/ftp.c b/lib/ftp.c
+index 16ab0af0d..5137ddca4 100644
+--- a/lib/ftp.c
++++ b/lib/ftp.c
+@@ -3154,7 +3154,7 @@ static CURLcode ftp_connect(struct Curl_easy *data,
+
+ PINGPONG_SETUP(pp, ftp_statemachine, ftp_endofresp);
+
+- if(conn->handler->flags & PROTOPT_SSL) {
++ if(Curl_conn_is_ssl(conn, FIRSTSOCKET)) {
+ /* BLOCKING */
+ result = Curl_conn_connect(data, FIRSTSOCKET, TRUE, done);
+ if(result)
+diff --git a/lib/http.c b/lib/http.c
+index 35e708551..8e9f0a52e 100644
+--- a/lib/http.c
++++ b/lib/http.c
+@@ -2526,7 +2526,7 @@ CURLcode Curl_http(struct Curl_easy *data, bool *done)
+ goto fail;
+ }
+
+- if(!(conn->handler->flags&PROTOPT_SSL) &&
++ if(!Curl_conn_is_ssl(conn, FIRSTSOCKET) &&
+ conn->httpversion < 20 &&
+ (data->state.httpwant == CURL_HTTP_VERSION_2)) {
+ /* append HTTP2 upgrade magic stuff to the HTTP request if it is not done
+@@ -2672,7 +2672,7 @@ CURLcode Curl_http_header(struct Curl_easy *data,
+ case 'A':
+ #ifndef CURL_DISABLE_ALTSVC
+ v = (data->asi &&
+- ((data->conn->handler->flags & PROTOPT_SSL) ||
++ (Curl_conn_is_ssl(data->conn, FIRSTSOCKET) ||
+ #ifdef DEBUGBUILD
+ /* allow debug builds to circumvent the HTTPS restriction */
+ getenv("CURL_ALTSVC_HTTP")
+@@ -2938,7 +2938,7 @@ CURLcode Curl_http_header(struct Curl_easy *data,
+ #ifndef CURL_DISABLE_HSTS
+ /* If enabled, the header is incoming and this is over HTTPS */
+ v = (data->hsts &&
+- ((conn->handler->flags & PROTOPT_SSL) ||
++ (Curl_conn_is_ssl(conn, FIRSTSOCKET) ||
+ #ifdef DEBUGBUILD
+ /* allow debug builds to circumvent the HTTPS restriction */
+ getenv("CURL_HSTS_HTTP")
+@@ -4160,7 +4160,7 @@ CURLcode Curl_http_req_to_h2(struct dynhds *h2_headers,
+ infof(data, "set pseudo header %s to %s", HTTP_PSEUDO_SCHEME, scheme);
+ }
+ else {
+- scheme = (data->conn && data->conn->handler->flags & PROTOPT_SSL) ?
++ scheme = Curl_conn_is_ssl(data->conn, FIRSTSOCKET) ?
+ "https" : "http";
+ }
+ }
+diff --git a/lib/http_negotiate.c b/lib/http_negotiate.c
+index 5d76bddf7..f031d0abc 100644
+--- a/lib/http_negotiate.c
++++ b/lib/http_negotiate.c
+@@ -27,6 +27,7 @@
+ #if !defined(CURL_DISABLE_HTTP) && defined(USE_SPNEGO)
+
+ #include "urldata.h"
++#include "cfilters.h"
+ #include "sendf.h"
+ #include "http_negotiate.h"
+ #include "vauth/vauth.h"
+@@ -109,7 +110,7 @@ CURLcode Curl_input_negotiate(struct Curl_easy *data, struct connectdata *conn,
+ #endif
+ /* Check if the connection is using SSL and get the channel binding data */
+ #if defined(USE_SSL) && defined(HAVE_GSSAPI)
+- if(conn->handler->flags & PROTOPT_SSL) {
++ if(Curl_conn_is_ssl(conn, FIRSTSOCKET)) {
+ Curl_dyn_init(&neg_ctx->channel_binding_data, SSL_CB_MAX_SIZE + 1);
+ result = Curl_ssl_get_channel_binding(
+ data, FIRSTSOCKET, &neg_ctx->channel_binding_data);
+diff --git a/lib/imap.c b/lib/imap.c
+index e424cdb05..df9dc343b 100644
+--- a/lib/imap.c
++++ b/lib/imap.c
+@@ -1390,7 +1390,7 @@ static CURLcode imap_multi_statemach(struct Curl_easy *data, bool *done)
+ struct connectdata *conn = data->conn;
+ struct imap_conn *imapc = &conn->proto.imapc;
+
+- if((conn->handler->flags & PROTOPT_SSL) && !imapc->ssldone) {
++ if(Curl_conn_is_ssl(conn, FIRSTSOCKET) && !imapc->ssldone) {
+ bool ssldone = FALSE;
+ result = Curl_conn_connect(data, FIRSTSOCKET, FALSE, &ssldone);
+ imapc->ssldone = ssldone;
+diff --git a/lib/ldap.c b/lib/ldap.c
+index 2cbdb9c21..7dd40acef 100644
+--- a/lib/ldap.c
++++ b/lib/ldap.c
+@@ -78,6 +78,7 @@
+
+ #include "urldata.h"
+ #include <curl/curl.h>
++#include "cfilters.h"
+ #include "sendf.h"
+ #include "escape.h"
+ #include "progress.h"
+@@ -346,7 +347,7 @@ static CURLcode ldap_do(struct Curl_easy *data, bool *done)
+ }
+
+ /* Get the URL scheme (either ldap or ldaps) */
+- if(conn->given->flags & PROTOPT_SSL)
++ if(Curl_conn_is_ssl(conn, FIRSTSOCKET))
+ ldap_ssl = 1;
+ infof(data, "LDAP local: trying to establish %s connection",
+ ldap_ssl ? "encrypted" : "cleartext");
+diff --git a/lib/openldap.c b/lib/openldap.c
+index 8c4af22be..9676ad3d0 100644
+--- a/lib/openldap.c
++++ b/lib/openldap.c
+@@ -571,7 +571,7 @@ static CURLcode oldap_connect(struct Curl_easy *data, bool *done)
+ ldap_set_option(li->ld, LDAP_OPT_REFERRALS, LDAP_OPT_OFF);
+
+ #ifdef USE_SSL
+- if(conn->handler->flags & PROTOPT_SSL)
++ if(Curl_conn_is_ssl(conn, FIRSTSOCKET))
+ return oldap_ssl_connect(data, OLDAP_SSL);
+
+ if(data->set.use_ssl) {
+diff --git a/lib/pop3.c b/lib/pop3.c
+index db6ec04c7..83dd64cda 100644
+--- a/lib/pop3.c
++++ b/lib/pop3.c
+@@ -1110,7 +1110,7 @@ static CURLcode pop3_multi_statemach(struct Curl_easy *data, bool *done)
+ struct connectdata *conn = data->conn;
+ struct pop3_conn *pop3c = &conn->proto.pop3c;
+
+- if((conn->handler->flags & PROTOPT_SSL) && !pop3c->ssldone) {
++ if(Curl_conn_is_ssl(conn, FIRSTSOCKET) && !pop3c->ssldone) {
+ bool ssldone = FALSE;
+ result = Curl_conn_connect(data, FIRSTSOCKET, FALSE, &ssldone);
+ pop3c->ssldone = ssldone;
+diff --git a/lib/smb.c b/lib/smb.c
+index a72ece62a..a2c82df5e 100644
+--- a/lib/smb.c
++++ b/lib/smb.c
+@@ -840,7 +840,7 @@ static CURLcode smb_connection_state(struct Curl_easy *data, bool *done)
+
+ if(smbc->state == SMB_CONNECTING) {
+ #ifdef USE_SSL
+- if((conn->handler->flags & PROTOPT_SSL)) {
++ if(Curl_conn_is_ssl(conn, FIRSTSOCKET)) {
+ bool ssl_done = FALSE;
+ result = Curl_conn_connect(data, FIRSTSOCKET, FALSE, &ssl_done);
+ if(result && result != CURLE_AGAIN)
+diff --git a/lib/smtp.c b/lib/smtp.c
+index d854d364f..c7fb0a4ca 100644
+--- a/lib/smtp.c
++++ b/lib/smtp.c
+@@ -1286,7 +1286,7 @@ static CURLcode smtp_multi_statemach(struct Curl_easy *data, bool *done)
+ struct connectdata *conn = data->conn;
+ struct smtp_conn *smtpc = &conn->proto.smtpc;
+
+- if((conn->handler->flags & PROTOPT_SSL) && !smtpc->ssldone) {
++ if(Curl_conn_is_ssl(conn, FIRSTSOCKET) && !smtpc->ssldone) {
+ bool ssldone = FALSE;
+ result = Curl_conn_connect(data, FIRSTSOCKET, FALSE, &ssldone);
+ smtpc->ssldone = ssldone;
+diff --git a/lib/url.c b/lib/url.c
+index 436edd891..de200e1dd 100644
+--- a/lib/url.c
++++ b/lib/url.c
+@@ -958,12 +958,12 @@ static bool url_match_conn(struct connectdata *conn, void *userdata)
+ return FALSE;
+ #endif
+
+- if((needle->handler->flags&PROTOPT_SSL) !=
+- (conn->handler->flags&PROTOPT_SSL))
+- /* do not do mixed SSL and non-SSL connections */
+- if(get_protocol_family(conn->handler) !=
+- needle->handler->protocol || !conn->bits.tls_upgraded)
+- /* except protocols that have been upgraded via TLS */
++ if((!(needle->handler->flags&PROTOPT_SSL) !=
++ !Curl_conn_is_ssl(conn, FIRSTSOCKET)) &&
++ !(get_protocol_family(conn->handler) == needle->handler->protocol &&
++ conn->bits.tls_upgraded))
++ /* Deny `conn` if it is not fit for `needle`'s SSL needs,
++ * UNLESS `conn` is the same protocol family and was upgraded to SSL. */
+ return FALSE;
+
+ #ifndef CURL_DISABLE_PROXY
+--
+2.48.1
+
diff --git a/curl.spec b/curl.spec
index ef932e9..c21fec2 100644
--- a/curl.spec
+++ b/curl.spec
@@ -7,7 +7,7 @@
Summary: A utility for getting files from remote servers (FTP, HTTP, and others)
Name: curl
Version: 8.11.1
-Release: 3%{?dist}
+Release: 4%{?dist}
License: curl
Source0: https://curl.se/download/%{name}-%{version}.tar.xz
Source1: https://curl.se/download/%{name}-%{version}.tar.xz.asc
@@ -22,6 +22,9 @@ Source2: mykey.asc
# https://github.com/curl/curl/pull/15727
Patch1: 0001-curl-8.11.1-eventfd.patch
+# Fix https://bugzilla.redhat.com/show_bug.cgi?id=2324130#c7
+Patch2: 0002-curl-8.11.1-TLS-check-connection-for-SSL-use-not-handler.patch
+
# patch making libcurl multilib ready
Patch101: 0101-curl-7.32.0-multilib.patch
@@ -416,6 +419,9 @@ rm -f ${RPM_BUILD_ROOT}%{_libdir}/libcurl.la
%{_libdir}/libcurl.so.4.[0-9].[0-9].minimal
%changelog
+* Fri Jan 31 2025 Jan Macku <jamacku@redhat.com> - 8.11.1-4
+- TLS: check connection for SSL use, not handler (#2324130#c7)
+
* Thu Jan 16 2025 Fedora Release Engineering <releng@fedoraproject.org> - 8.11.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-03 12:39 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-03 12:39 [rpms/curl] curl-v8.23.0-3: TLS: check connection for SSL use, not handler Jan Macku
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox