[curl/f19] fix a connection failure when FTPS handle is reused

Kamil Dudka kdudka at fedoraproject.org
Tue Oct 21 11:02:54 UTC 2014


commit 74b37528d073092b8190313b8d9fc373fd7d5d05
Author: Kamil Dudka <kdudka at redhat.com>
Date:   Tue Oct 21 12:14:19 2014 +0200

    fix a connection failure when FTPS handle is reused

 0027-curl-7.29.0-0aecdf68.patch |   67 +++++++++++++++++++++++++++++++++++++++
 curl.spec                       |    9 +++++-
 2 files changed, 75 insertions(+), 1 deletions(-)
---
diff --git a/0027-curl-7.29.0-0aecdf68.patch b/0027-curl-7.29.0-0aecdf68.patch
new file mode 100644
index 0000000..96867f4
--- /dev/null
+++ b/0027-curl-7.29.0-0aecdf68.patch
@@ -0,0 +1,67 @@
+From 3b5763fcce74f1e711097e09f6d70a1bc062ae38 Mon Sep 17 00:00:00 2001
+From: Kamil Dudka <kdudka at redhat.com>
+Date: Mon, 20 Oct 2014 18:18:57 +0200
+Subject: [PATCH] nss: reset SSL handshake state machine
+
+... when the handshake succeeds
+
+This fixes a connection failure when FTPS handle is reused.
+
+Upstream-commit: 0aecdf682895b42c25b232e91529f48bdf7738b3
+Signed-off-by: Kamil Dudka <kdudka at redhat.com>
+---
+ lib/nss.c | 17 +++++++++--------
+ 1 file changed, 9 insertions(+), 8 deletions(-)
+
+diff --git a/lib/nss.c b/lib/nss.c
+index 70e67c6..40daee3 100644
+--- a/lib/nss.c
++++ b/lib/nss.c
+@@ -1315,9 +1315,6 @@ static CURLcode nss_setup_connect(struct connectdata *conn, int sockindex)
+   CURLcode curlerr;
+   const int *cipher_to_enable;
+ 
+-  if(connssl->state == ssl_connection_complete)
+-    return CURLE_OK;
+-
+   connssl->data = data;
+ 
+   /* list of all NSS objects we need to destroy in Curl_nss_close() */
+@@ -1577,10 +1574,6 @@ static CURLcode nss_do_connect(struct connectdata *conn, int sockindex)
+     goto error;
+   }
+ 
+-  connssl->state = ssl_connection_complete;
+-  conn->recv[sockindex] = nss_recv;
+-  conn->send[sockindex] = nss_send;
+-
+   display_conn_info(conn, connssl->handle);
+ 
+   if(data->set.str[STRING_SSL_ISSUERCERT]) {
+@@ -1616,6 +1609,9 @@ static CURLcode nss_connect_common(struct connectdata *conn, int sockindex,
+   const bool blocking = (done == NULL);
+   CURLcode rv;
+ 
++  if(connssl->state == ssl_connection_complete)
++    return CURLE_OK;
++
+   if(connssl->connecting_state == ssl_connect_1) {
+     rv = nss_setup_connect(conn, sockindex);
+     if(rv)
+@@ -1655,7 +1651,12 @@ static CURLcode nss_connect_common(struct connectdata *conn, int sockindex,
+     /* signal completed SSL handshake */
+     *done = TRUE;
+ 
+-  connssl->connecting_state = ssl_connect_done;
++  connssl->state = ssl_connection_complete;
++  conn->recv[sockindex] = nss_recv;
++  conn->send[sockindex] = nss_send;
++
++  /* ssl_connect_done is never used outside, go back to the initial state */
++  connssl->connecting_state = ssl_connect_1;
+   return CURLE_OK;
+ }
+  
+-- 
+2.1.0
+
diff --git a/curl.spec b/curl.spec
index eb7581e..6dc8410 100644
--- a/curl.spec
+++ b/curl.spec
@@ -1,7 +1,7 @@
 Summary: A utility for getting files from remote servers (FTP, HTTP, and others)
 Name: curl
 Version: 7.29.0
-Release: 23%{?dist}
+Release: 24%{?dist}
 License: MIT
 Group: Applications/Internet
 Source: http://curl.haxx.se/download/%{name}-%{version}.tar.lzma
@@ -82,6 +82,9 @@ Patch25: 0025-curl-7.29.0-CVE-2014-3613.patch
 # reject incoming cookies set for top level domains (CVE-2014-3620)
 Patch26: 0026-curl-7.29.0-CVE-2014-3620.patch
 
+# fix a connection failure when FTPS handle is reused
+Patch27: 0027-curl-7.29.0-0aecdf68.patch
+
 # patch making libcurl multilib ready
 Patch101: 0101-curl-7.29.0-multilib.patch
 
@@ -215,6 +218,7 @@ documentation of the library, too.
 %patch24 -p1
 %patch25 -p1
 %patch26 -p1
+%patch27 -p1
 
 # Fedora patches
 %patch101 -p1
@@ -335,6 +339,9 @@ rm -rf $RPM_BUILD_ROOT
 %{_datadir}/aclocal/libcurl.m4
 
 %changelog
+* Tue Oct 21 2014 Kamil Dudka <kdudka at redhat.com> 7.29.0-24
+- fix a connection failure when FTPS handle is reused
+
 * Wed Sep 10 2014 Kamil Dudka <kdudka at redhat.com> 7.29.0-23
 - use only full matches for hosts used as IP address in cookies (CVE-2014-3613)
 - reject incoming cookies set for top level domains (CVE-2014-3620)


More information about the scm-commits mailing list