cURL / Mailing Lists / curl-library / Single Mail

curl-library

curl crashes when trying to scp over socks4

From: Hans-Jürgen May <menner_at_arcor.de>
Date: Mon, 16 Jun 2008 10:32:15 +0200

curl crashes when trying to scp over socks4.
the reason is:
curl 7.18.2 is talking ssh to the socks proxy
This is my fix for the issue (I posted that on the curl-users list, but here
it is in diff -u format) :

diff -U4 sendf.c sendf.c.new
--- sendf.c 2008-05-09 14:45:48.000000000 +0200
+++ sendf.c.new 2008-06-16 08:53:40.000000000 +0200
@@ -358,11 +358,11 @@
   if(conn->ssl[num].state == ssl_connection_complete)
     /* only TRUE if SSL enabled */
     bytes_written = Curl_ssl_send(conn, num, mem, len);
 #ifdef USE_LIBSSH2
- else if(conn->protocol & PROT_SCP)
+ else if((conn->protocol & PROT_SCP) && (conn->proto.sshc.state >
SSH_STOP))
     bytes_written = Curl_scp_send(conn, num, mem, len);
- else if(conn->protocol & PROT_SFTP)
+ else if((conn->protocol & PROT_SFTP) && (conn->proto.sshc.state >
SSH_STOP))
     bytes_written = Curl_sftp_send(conn, num, mem, len);
 #endif /* !USE_LIBSSH2 */
   else if(conn->sec_complete)
     /* only TRUE if krb enabled */
@@ -574,9 +574,9 @@
       return -1; /* -1 from Curl_ssl_recv() means EWOULDBLOCK */
     }
   }
 #ifdef USE_LIBSSH2
- else if(conn->protocol & (PROT_SCP|PROT_SFTP)) {
+ else if((conn->protocol & (PROT_SCP|PROT_SFTP)) &&
(conn->proto.sshc.state > SSH_STOP)) {
     if(conn->protocol & PROT_SCP)
       nread = Curl_scp_recv(conn, num, buffertofill, bytesfromsocket);
     else if(conn->protocol & PROT_SFTP)
       nread = Curl_sftp_recv(conn, num, buffertofill, bytesfromsocket);
Received on 2008-06-16