Blame SOURCES/0004-curl-7.76.1-ldaps-segv.patch

d889a8
From 39b68b3f82535d06e50443db4c191dbaa00df4eb Mon Sep 17 00:00:00 2001
d889a8
From: Patrick Monnerat <patrick@monnerat.net>
d889a8
Date: Fri, 23 Apr 2021 00:33:46 +0200
d889a8
Subject: [PATCH] vtls: reset ssl use flag upon negotiation failure
d889a8
d889a8
Fixes the segfault in ldaps disconnect.
d889a8
d889a8
Reported-by: Illarion Taev
d889a8
Fixes #6934
d889a8
Closes #6937
d889a8
d889a8
Upstream-commit: a4554b2c5e7c5788c8198001598818599c60ff7d
d889a8
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
d889a8
---
d889a8
 lib/vtls/vtls.c | 6 +++++-
d889a8
 1 file changed, 5 insertions(+), 1 deletion(-)
d889a8
d889a8
diff --git a/lib/vtls/vtls.c b/lib/vtls/vtls.c
d889a8
index 22cfb88..fa8a6fa 100644
d889a8
--- a/lib/vtls/vtls.c
d889a8
+++ b/lib/vtls/vtls.c
d889a8
@@ -315,6 +315,8 @@ Curl_ssl_connect(struct Curl_easy *data, struct connectdata *conn,
d889a8
 
d889a8
   if(!result)
d889a8
     Curl_pgrsTime(data, TIMER_APPCONNECT); /* SSL is connected */
d889a8
+  else
d889a8
+    conn->ssl[sockindex].use = FALSE;
d889a8
 
d889a8
   return result;
d889a8
 }
d889a8
@@ -338,7 +340,9 @@ Curl_ssl_connect_nonblocking(struct Curl_easy *data, struct connectdata *conn,
d889a8
   /* mark this is being ssl requested from here on. */
d889a8
   conn->ssl[sockindex].use = TRUE;
d889a8
   result = Curl_ssl->connect_nonblocking(data, conn, sockindex, done);
d889a8
-  if(!result && *done)
d889a8
+  if(result)
d889a8
+    conn->ssl[sockindex].use = FALSE;
d889a8
+  else if(*done)
d889a8
     Curl_pgrsTime(data, TIMER_APPCONNECT); /* SSL is connected */
d889a8
   return result;
d889a8
 }
d889a8
-- 
d889a8
2.31.1
d889a8