diff options
author | Daniel Stenberg <daniel@haxx.se> | 2008-06-20 10:43:32 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2008-06-20 10:43:32 +0000 |
commit | 422fd933f508225d3d95128ba97ae3e38dff53dc (patch) | |
tree | 11a78f4d2d1a98996b8d9b8e3e8abb9316dee802 /lib/socks.c | |
parent | 2594124825980231ffe024d00a9ac43bcb4c3553 (diff) |
- Hans-Jurgen May pointed out that trying SCP or SFTP over a SOCKS proxy
crashed libcurl. This is now addressed by making sure we use "plain send"
internally when doing the socks handshake instead of the Curl_write()
function which is designed to use the "target" protocol. That's then SCP or
SFTP in this case. I also took the opportunity and cleaned up some ssh-
related #ifdefs in the code for readability.
Diffstat (limited to 'lib/socks.c')
-rw-r--r-- | lib/socks.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/socks.c b/lib/socks.c index 06a513e80..d2cb65522 100644 --- a/lib/socks.c +++ b/lib/socks.c @@ -242,8 +242,9 @@ CURLcode Curl_SOCKS4(const char *proxy_name, } /* Send request */ - code = Curl_write(conn, sock, (char *)socksreq, packetsize + hostnamelen, - &written); + code = Curl_write_plain(conn, sock, (char *)socksreq, + packetsize + hostnamelen, + &written); if((code != CURLE_OK) || (written != packetsize + hostnamelen)) { failf(data, "Failed to send SOCKS4 connect request."); return CURLE_COULDNT_CONNECT; @@ -251,7 +252,8 @@ CURLcode Curl_SOCKS4(const char *proxy_name, if (protocol4a && hostnamelen == 0) { /* SOCKS4a with very long hostname - send that name separately */ hostnamelen = (ssize_t)strlen(hostname) + 1; - code = Curl_write(conn, sock, (char *)hostname, hostnamelen, &written); + code = Curl_write_plain(conn, sock, (char *)hostname, hostnamelen, + &written); if((code != CURLE_OK) || (written != hostnamelen)) { failf(data, "Failed to send SOCKS4 connect request."); return CURLE_COULDNT_CONNECT; @@ -432,8 +434,8 @@ CURLcode Curl_SOCKS5(const char *proxy_name, Curl_nonblock(sock, FALSE); - code = Curl_write(conn, sock, (char *)socksreq, (2 + (int)socksreq[1]), - &written); + code = Curl_write_plain(conn, sock, (char *)socksreq, (2 + (int)socksreq[1]), + &written); if((code != CURLE_OK) || (written != (2 + (int)socksreq[1]))) { failf(data, "Unable to send initial SOCKS5 request."); return CURLE_COULDNT_CONNECT; @@ -502,7 +504,7 @@ CURLcode Curl_SOCKS5(const char *proxy_name, memcpy(socksreq + len, proxy_password, (int) pwlen); len += pwlen; - code = Curl_write(conn, sock, (char *)socksreq, len, &written); + code = Curl_write_plain(conn, sock, (char *)socksreq, len, &written); if((code != CURLE_OK) || (len != written)) { failf(data, "Failed to send SOCKS5 sub-negotiation request."); return CURLE_COULDNT_CONNECT; @@ -613,7 +615,7 @@ CURLcode Curl_SOCKS5(const char *proxy_name, *((unsigned short*)&socksreq[8]) = htons((unsigned short)remote_port); } - code = Curl_write(conn, sock, (char *)socksreq, packetsize, &written); + code = Curl_write_plain(conn, sock, (char *)socksreq, packetsize, &written); if((code != CURLE_OK) || (written != packetsize)) { failf(data, "Failed to send SOCKS5 connect request."); return CURLE_COULDNT_CONNECT; |