cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: libcurl crashes when reusing a curl handle over SFTP after calling curl_easy_reset()

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Sat, 8 Mar 2008 23:12:48 +0100 (CET)

On Fri, 7 Mar 2008, Brian Ulm wrote:

> I'm having some issues with reusing a SFTP curl handle after sending the
> curl_easy_reset() command.

Please try the patch below and let us know if it fixes the problem for you:

--- lib/ssh.c 4 Mar 2008 11:53:15 -0000 1.95
+++ lib/ssh.c 8 Mar 2008 22:11:50 -0000
@@ -2109,6 +2109,18 @@

    *done = FALSE; /* default to false */

+ /*
+ Since connections can be re-used between SessionHandles, this might be a
+ connection already existing but on a fresh SessionHandle struct so we must
+ make sure we have a good 'struct SSHPROTO' to play with. For new
+ connections, the struct SSHPROTO is allocated and setup in the
+ ssh_connect() function.
+ */
+ Curl_reset_reqproto(conn);
+ res = ssh_init(conn);
+ if(res)
+ return res;
+
    data->req.size = -1; /* make sure this is unknown at this point */

    Curl_pgrsSetUploadCounter(data, 0);

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2008-03-08