08ada4d
From 9d6dd7bc1dea42ae8e710aeae714e2a2c290de61 Mon Sep 17 00:00:00 2001
08ada4d
From: Daniel Stenberg <daniel@haxx.se>
08ada4d
Date: Fri, 10 Mar 2023 09:22:43 +0100
08ada4d
Subject: [PATCH] url: only reuse connections with same GSS delegation
08ada4d
08ada4d
Reported-by: Harry Sintonen
08ada4d
Closes #10731
08ada4d
08ada4d
Upstream-commit: cb49e67303dbafbab1cebf4086e3ec15b7d56ee5
08ada4d
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
08ada4d
---
08ada4d
 lib/url.c     | 6 ++++++
08ada4d
 lib/urldata.h | 1 +
08ada4d
 2 files changed, 7 insertions(+)
08ada4d
08ada4d
diff --git a/lib/url.c b/lib/url.c
08ada4d
index 3b11b7e..cbbc7f3 100644
08ada4d
--- a/lib/url.c
08ada4d
+++ b/lib/url.c
08ada4d
@@ -1371,6 +1371,11 @@ ConnectionExists(struct Curl_easy *data,
08ada4d
         }
08ada4d
       }
08ada4d
 
08ada4d
+      /* GSS delegation differences do not actually affect every connection
08ada4d
+         and auth method, but this check takes precaution before efficiency */
08ada4d
+      if(needle->gssapi_delegation != check->gssapi_delegation)
08ada4d
+        continue;
08ada4d
+
08ada4d
       /* If multiplexing isn't enabled on the h2 connection and h1 is
08ada4d
          explicitly requested, handle it: */
08ada4d
       if((needle->handler->protocol & PROTO_FAMILY_HTTP) &&
08ada4d
@@ -1838,6 +1843,7 @@ static struct connectdata *allocate_conn(struct Curl_easy *data)
08ada4d
   conn->fclosesocket = data->set.fclosesocket;
08ada4d
   conn->closesocket_client = data->set.closesocket_client;
08ada4d
   conn->lastused = Curl_now(); /* used now */
08ada4d
+  conn->gssapi_delegation = data->set.gssapi_delegation;
08ada4d
 
08ada4d
   return conn;
08ada4d
   error:
08ada4d
diff --git a/lib/urldata.h b/lib/urldata.h
08ada4d
index ce90304..9e16f26 100644
08ada4d
--- a/lib/urldata.h
08ada4d
+++ b/lib/urldata.h
08ada4d
@@ -1124,6 +1124,7 @@ struct connectdata {
08ada4d
   unsigned char transport; /* one of the TRNSPRT_* defines */
08ada4d
   unsigned char ip_version; /* copied from the Curl_easy at creation time */
08ada4d
   unsigned char httpversion; /* the HTTP version*10 reported by the server */
08ada4d
+  unsigned char gssapi_delegation; /* inherited from set.gssapi_delegation */
08ada4d
 };
08ada4d
 
08ada4d
 /* The end of connectdata. */
08ada4d
-- 
08ada4d
2.39.2
08ada4d