curl/backport-CVE-2023-27536.patch
xingwei 1f4ae73b6d Patch optimization for CVE-2023-27536
(cherry picked from commit e536c225628e8d32f928c74492894b02fb183df0)
2023-04-12 15:11:26 +08:00

52 lines
1.7 KiB
Diff

From cb49e67303dbafbab1cebf4086e3ec15b7d56ee5 Mon Sep 17 00:00:00 2001
From: Daniel Stenberg <daniel@haxx.se>
Date: Fri, 10 Mar 2023 09:22:43 +0100
Subject: [PATCH] url: only reuse connections with same GSS delegation
Reported-by: Harry Sintonen
Closes #10731
---
lib/url.c | 6 ++++++
lib/urldata.h | 1 +
2 files changed, 7 insertions(+)
diff --git a/lib/url.c b/lib/url.c
index e5b45e6..2f9f19f 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -1276,6 +1276,11 @@ ConnectionExists(struct Curl_easy *data,
}
}
+ /* GSS delegation differences do not actually affect every connection
+ and auth method, but this check takes precaution before efficiency */
+ if(needle->gssapi_delegation != check->gssapi_delegation)
+ continue;
+
#ifdef USE_SSH
else if(get_protocol_family(needle->handler) & PROTO_FAMILY_SSH) {
if(!ssh_config_matches(needle, check))
@@ -1743,6 +1748,7 @@ static struct connectdata *allocate_conn(struct Curl_easy *data)
conn->fclosesocket = data->set.fclosesocket;
conn->closesocket_client = data->set.closesocket_client;
conn->lastused = Curl_now(); /* used now */
+ conn->gssapi_delegation = data->set.gssapi_delegation;
return conn;
error:
diff --git a/lib/urldata.h b/lib/urldata.h
index aca0f39..8f823c4 100644
--- a/lib/urldata.h
+++ b/lib/urldata.h
@@ -998,6 +998,7 @@ struct connectdata {
const struct Curl_handler *given; /* The protocol first given */
long ip_version; /* copied from the Curl_easy at creation time */
+ long gssapi_delegation; /* inherited from set.gssapi_delegation */
/* Protocols can use a custom keepalive mechanism to keep connections alive.
This allows those protocols to track the last time the keepalive mechanism
--
2.33.0