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

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