rpms/curl/devel curl-7.20.1-157f20f.patch, NONE, 1.1 curl-7.20.1-d487ade.patch, NONE, 1.1 curl.spec, 1.152, 1.153 curl-7.19.7-s390-sleep.patch, 1.4, NONE curl-7.20.1-threaded-dns-multi.patch, 1.1, NONE

Kamil Dudka kdudka at fedoraproject.org
Sat Apr 24 21:40:02 UTC 2010


Author: kdudka

Update of /cvs/extras/rpms/curl/devel
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv2361

Modified Files:
	curl.spec 
Added Files:
	curl-7.20.1-157f20f.patch curl-7.20.1-d487ade.patch 
Removed Files:
	curl-7.19.7-s390-sleep.patch 
	curl-7.20.1-threaded-dns-multi.patch 
Log Message:
- upstream patch preventing failure of test536 with threaded DNS resolver
- upstream patch preventing SSL handshake timeout underflow

curl-7.20.1-157f20f.patch:
 CHANGES   |    3 +++
 lib/nss.c |   10 +++++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

--- NEW FILE curl-7.20.1-157f20f.patch ---
>From 157f20fd2ce7d8519b863e57f3d77d17fb41bc9c Mon Sep 17 00:00:00 2001
From: Kamil Dudka <kdudka at redhat.com>
Date: Sat, 24 Apr 2010 23:21:13 +0200
Subject: [PATCH] nss: fix SSL handshake timeout underflow

 lib/nss.c |   10 +++++++++-
 2 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/CHANGES b/CHANGES
index 99f04a5..7433364 100644
--- a/CHANGES
+++ b/CHANGES
@@ -10,6 +10,9 @@ Kamil Dudka (24 Apr 2010)
 - Fixed test536 in order to not fail with threaded DNS resolver and tweaked
   comments in certain examples using curl_multi_fdset().
 
+- Fixed SSL handshake timeout underflow in libcurl-NSS, which caused test405
+  to hang on a slow machine.
+
 Version 7.20.1 (14 April 2010)
 
 Daniel Stenberg (9 Apr 2010)
diff --git a/lib/nss.c b/lib/nss.c
index 0f8ebd5..addb94b 100644
--- a/lib/nss.c
+++ b/lib/nss.c
@@ -1025,6 +1025,7 @@ CURLcode Curl_nss_connect(struct connectdata *conn, int sockindex)
   int curlerr;
   const int *cipher_to_enable;
   PRSocketOptionData sock_opt;
+  long time_left;
   PRUint32 timeout;
 
   curlerr = CURLE_SSL_CONNECT_ERROR;
@@ -1302,8 +1303,15 @@ CURLcode Curl_nss_connect(struct connectdata *conn, int sockindex)
 
   SSL_SetURL(connssl->handle, conn->host.name);
 
+  /* check timeout situation */
+  time_left = Curl_timeleft(conn, NULL, TRUE);
+  if(time_left < 0L) {
+    failf(data, "timed out before SSL handshake");
+    goto error;
+  }
+  timeout = PR_MillisecondsToInterval((PRUint32) time_left);
+
   /* Force the handshake now */
-  timeout = PR_MillisecondsToInterval((PRUint32)Curl_timeleft(conn, NULL, TRUE));
   if(SSL_ForceHandshakeWithTimeout(connssl->handle, timeout) != SECSuccess) {
     if(conn->data->set.ssl.certverifyresult == SSL_ERROR_BAD_CERT_DOMAIN)
       curlerr = CURLE_PEER_FAILED_VERIFICATION;

curl-7.20.1-d487ade.patch:
 CHANGES                             |    4 ++++
 docs/examples/fopen.c               |    8 +++++---
 docs/examples/multi-app.c           |    8 +++++---
 docs/examples/multi-debugcallback.c |    8 +++++---
 docs/examples/multi-double.c        |    8 +++++---
 docs/examples/multi-post.c          |    8 +++++---
 docs/examples/multi-single.c        |    8 +++++---
 tests/libtest/lib536.c              |   16 ++++++++++++----
 8 files changed, 46 insertions(+), 22 deletions(-)

--- NEW FILE curl-7.20.1-d487ade.patch ---
>From d487ade72c5f31703ce097e8460e0225fad80348 Mon Sep 17 00:00:00 2001
From: Kamil Dudka <kdudka at redhat.com>
Date: Sat, 24 Apr 2010 12:14:21 +0200
Subject: [PATCH] test536: do not fail with threaded DNS resolver

Also tweaked comments in certain examples using curl_multi_fdset().
---
 CHANGES                             |    4 ++++
 docs/examples/fopen.c               |    8 +++++---
 docs/examples/multi-app.c           |    8 +++++---
 docs/examples/multi-debugcallback.c |    8 +++++---
 docs/examples/multi-double.c        |    8 +++++---
 docs/examples/multi-post.c          |    8 +++++---
 docs/examples/multi-single.c        |    8 +++++---
 tests/libtest/lib536.c              |   16 ++++++++++++----
 8 files changed, 46 insertions(+), 22 deletions(-)

diff --git a/CHANGES b/CHANGES
index 9ae615a..99f04a5 100644
--- a/CHANGES
+++ b/CHANGES
@@ -6,6 +6,10 @@
 
                                   Changelog
 
+Kamil Dudka (24 Apr 2010)
+- Fixed test536 in order to not fail with threaded DNS resolver and tweaked
+  comments in certain examples using curl_multi_fdset().
+
 Version 7.20.1 (14 April 2010)
 
 Daniel Stenberg (9 Apr 2010)
diff --git a/docs/examples/fopen.c b/docs/examples/fopen.c
index e3814e6..35e24b1 100644
--- a/docs/examples/fopen.c
+++ b/docs/examples/fopen.c
@@ -131,7 +131,6 @@ fill_buffer(URL_FILE *file,int want,int waittime)
     fd_set fdread;
     fd_set fdwrite;
     fd_set fdexcep;
-    int maxfd;
     struct timeval timeout;
     int rc;
 
@@ -144,6 +143,7 @@ fill_buffer(URL_FILE *file,int want,int waittime)
     /* attempt to fill buffer */
     do
     {
+        int maxfd = -1;
         FD_ZERO(&fdread);
         FD_ZERO(&fdwrite);
         FD_ZERO(&fdexcep);
@@ -156,8 +156,10 @@ fill_buffer(URL_FILE *file,int want,int waittime)
         curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd);
 
         /* In a real-world program you OF COURSE check the return code of the
-           function calls, *and* you make sure that maxfd is bigger than -1
-           so that the call to select() below makes sense! */
+           function calls.  On success, the value of maxfd is guaranteed to be
+           greater or equal than -1.  We call select(maxfd + 1, ...), specially
+           in case of (maxfd == -1), we call select(0, ...), which is basically
+           equal to sleep. */
 
         rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
 
diff --git a/docs/examples/multi-app.c b/docs/examples/multi-app.c
index a86dd0e..38b50cd 100644
--- a/docs/examples/multi-app.c
+++ b/docs/examples/multi-app.c
@@ -66,7 +66,7 @@ int main(int argc, char **argv)
     fd_set fdread;
     fd_set fdwrite;
     fd_set fdexcep;
-    int maxfd;
+    int maxfd = -1;
 
     FD_ZERO(&fdread);
     FD_ZERO(&fdwrite);
@@ -80,8 +80,10 @@ int main(int argc, char **argv)
     curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd);
 
     /* In a real-world program you OF COURSE check the return code of the
-       function calls, *and* you make sure that maxfd is bigger than -1 so
-       that the call to select() below makes sense! */
+       function calls.  On success, the value of maxfd is guaranteed to be
+       greater or equal than -1.  We call select(maxfd + 1, ...), specially in
+       case of (maxfd == -1), we call select(0, ...), which is basically equal
+       to sleep. */
 
     rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
 
diff --git a/docs/examples/multi-debugcallback.c b/docs/examples/multi-debugcallback.c
index b10b47c..8e964c6 100644
--- a/docs/examples/multi-debugcallback.c
+++ b/docs/examples/multi-debugcallback.c
@@ -140,7 +140,7 @@ int main(int argc, char **argv)
     fd_set fdread;
     fd_set fdwrite;
     fd_set fdexcep;
-    int maxfd;
+    int maxfd = -1;
 
     FD_ZERO(&fdread);
     FD_ZERO(&fdwrite);
@@ -154,8 +154,10 @@ int main(int argc, char **argv)
     curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd);
 
     /* In a real-world program you OF COURSE check the return code of the
-       function calls, *and* you make sure that maxfd is bigger than -1
-       so that the call to select() below makes sense! */
+       function calls.  On success, the value of maxfd is guaranteed to be
+       greater or equal than -1.  We call select(maxfd + 1, ...), specially in
+       case of (maxfd == -1), we call select(0, ...), which is basically equal
+       to sleep. */
 
     rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
 
diff --git a/docs/examples/multi-double.c b/docs/examples/multi-double.c
index ef3bf92..bc5b446 100644
--- a/docs/examples/multi-double.c
+++ b/docs/examples/multi-double.c
@@ -57,7 +57,7 @@ int main(int argc, char **argv)
     fd_set fdread;
     fd_set fdwrite;
     fd_set fdexcep;
-    int maxfd;
+    int maxfd = -1;
 
     FD_ZERO(&fdread);
     FD_ZERO(&fdwrite);
@@ -71,8 +71,10 @@ int main(int argc, char **argv)
     curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd);
 
     /* In a real-world program you OF COURSE check the return code of the
-       function calls, *and* you make sure that maxfd is bigger than -1 so
-       that the call to select() below makes sense! */
+       function calls.  On success, the value of maxfd is guaranteed to be
+       greater or equal than -1.  We call select(maxfd + 1, ...), specially in
+       case of (maxfd == -1), we call select(0, ...), which is basically equal
+       to sleep. */
 
     rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
 
diff --git a/docs/examples/multi-post.c b/docs/examples/multi-post.c
index 229e843..0d3f78e 100644
--- a/docs/examples/multi-post.c
+++ b/docs/examples/multi-post.c
@@ -77,7 +77,7 @@ int main(int argc, char *argv[])
       fd_set fdread;
       fd_set fdwrite;
       fd_set fdexcep;
-      int maxfd;
+      int maxfd = -1;
 
       FD_ZERO(&fdread);
       FD_ZERO(&fdwrite);
@@ -91,8 +91,10 @@ int main(int argc, char *argv[])
       curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd);
 
       /* In a real-world program you OF COURSE check the return code of the
-         function calls, *and* you make sure that maxfd is bigger than -1
-         so that the call to select() below makes sense! */
+         function calls.  On success, the value of maxfd is guaranteed to be
+         greater or equal than -1.  We call select(maxfd + 1, ...), specially in
+         case of (maxfd == -1), we call select(0, ...), which is basically equal
+         to sleep. */
 
       rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
 
diff --git a/docs/examples/multi-single.c b/docs/examples/multi-single.c
index 3e236f3..cba4f32 100644
--- a/docs/examples/multi-single.c
+++ b/docs/examples/multi-single.c
@@ -51,7 +51,7 @@ int main(int argc, char **argv)
     fd_set fdread;
     fd_set fdwrite;
     fd_set fdexcep;
-    int maxfd;
+    int maxfd = -1;
 
     FD_ZERO(&fdread);
     FD_ZERO(&fdwrite);
@@ -65,8 +65,10 @@ int main(int argc, char **argv)
     curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd);
 
     /* In a real-world program you OF COURSE check the return code of the
-       function calls, *and* you make sure that maxfd is bigger than -1 so
-       that the call to select() below makes sense! */
+       function calls.  On success, the value of maxfd is guaranteed to be
+       greater or equal than -1.  We call select(maxfd + 1, ...), specially in
+       case of (maxfd == -1), we call select(0, ...), which is basically equal
+       to sleep. */
 
     rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
 
diff --git a/tests/libtest/lib536.c b/tests/libtest/lib536.c
index 04bc696..e0c19f6 100644
--- a/tests/libtest/lib536.c
+++ b/tests/libtest/lib536.c
@@ -21,7 +21,7 @@
 
 static CURLMcode perform(CURLM * multi)
 {
-  int handles, maxfd;
+  int handles;
   CURLMcode code;
   fd_set fdread, fdwrite, fdexcep;
   struct timeval mp_start;
@@ -31,6 +31,9 @@ static CURLMcode perform(CURLM * multi)
   mp_start = tutil_tvnow();
 
   for (;;) {
+    static struct timeval timeout = /* 100 ms */ { 0, 100000L };
+    int maxfd = -1;
+
     code = curl_multi_perform(multi, &handles);
     if (tutil_tvdiff(tutil_tvnow(), mp_start) >
         MULTI_PERFORM_HANG_TIMEOUT) {
@@ -53,9 +56,14 @@ static CURLMcode perform(CURLM * multi)
     FD_ZERO(&fdwrite);
     FD_ZERO(&fdexcep);
     curl_multi_fdset(multi, &fdread, &fdwrite, &fdexcep, &maxfd);
-    if (maxfd < 0)
-      return (CURLMcode) ~CURLM_OK;
-    if (select(maxfd + 1, &fdread, &fdwrite, &fdexcep, 0) == -1)
+
+    /* In a real-world program you OF COURSE check the return code of the
+       function calls.  On success, the value of maxfd is guaranteed to be
+       greater or equal than -1.  We call select(maxfd + 1, ...), specially in
+       case of (maxfd == -1), we call select(0, ...), which is basically equal
+       to sleep. */
+
+    if (select(maxfd + 1, &fdread, &fdwrite, &fdexcep, &timeout) == -1)
       return (CURLMcode) ~CURLM_OK;
   }
 


Index: curl.spec
===================================================================
RCS file: /cvs/extras/rpms/curl/devel/curl.spec,v
retrieving revision 1.152
retrieving revision 1.153
diff -u -p -r1.152 -r1.153
--- curl.spec	22 Apr 2010 15:27:30 -0000	1.152
+++ curl.spec	24 Apr 2010 21:40:02 -0000	1.153
@@ -1,7 +1,7 @@
 Summary: A utility for getting files from remote servers (FTP, HTTP, and others)
 Name: curl
 Version: 7.20.1
-Release: 3%{?dist}
+Release: 4%{?dist}
 License: MIT
 Group: Applications/Internet
 Source: http://curl.haxx.se/download/%{name}-%{version}.tar.lzma
@@ -10,8 +10,11 @@ Source2: curlbuild.h
 # upstream commit e32fe30d0cf7c1f7045ac0bd29322e7fb4feb5c8
 Patch0: curl-7.20.0-e32fe30.patch
 
-# experimentally enabled threaded DNS lookup
-Patch1: curl-7.20.1-threaded-dns-multi.patch
+# upstream commit d487ade72c5f31703ce097e8460e0225fad80348
+Patch1: curl-7.20.1-d487ade.patch
+
+# upstream commit 157f20fd2ce7d8519b863e57f3d77d17fb41bc9c
+Patch2: curl-7.20.1-157f20f.patch
 
 # patch making libcurl multilib ready
 Patch101: curl-7.20.0-multilib.patch
@@ -104,8 +107,9 @@ done
 # revert an upstream commit which breaks Fedora builds
 %patch0 -p1 -R
 
-# upstream patches (not yet applied)
+# upstream patches (already applied)
 %patch1 -p1
+%patch2 -p1
 
 # Fedora patches
 %patch101 -p1
@@ -215,6 +219,10 @@ rm -rf $RPM_BUILD_ROOT
 %{_datadir}/aclocal/libcurl.m4
 
 %changelog
+* Sat Apr 24 2010 Kamil Dudka <kdudka at redhat.com> 7.20.1-4
+- upstream patch preventing failure of test536 with threaded DNS resolver
+- upstream patch preventing SSL handshake timeout underflow
+
 * Thu Apr 22 2010 Paul Howarth <paul at city-fan.org> 7.20.1-3
 - replace Rawhide s390-sleep patch with a more targeted patch adding a
   delay after tests 513 and 514 rather than after all tests


--- curl-7.19.7-s390-sleep.patch DELETED ---


--- curl-7.20.1-threaded-dns-multi.patch DELETED ---



More information about the scm-commits mailing list