aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES4
-rw-r--r--RELEASE-NOTES5
-rw-r--r--docs/KNOWN_BUGS13
-rw-r--r--lib/ftp.c17
-rw-r--r--lib/socks.c22
-rw-r--r--lib/socks.h6
-rw-r--r--lib/url.c6
7 files changed, 56 insertions, 17 deletions
diff --git a/CHANGES b/CHANGES
index aa11640b5..f75ef4f4b 100644
--- a/CHANGES
+++ b/CHANGES
@@ -6,6 +6,10 @@
Changelog
+Daniel (19 February 2007)
+- Robson Braga Araujo made passive FTP transfers work with SOCKS (both 4 and
+ 5).
+
Daniel (18 February 2007)
- Jeff Pohlmeyer identified two problems: first a rather obscure problem with
the multi interface and connection re-use that could make a
diff --git a/RELEASE-NOTES b/RELEASE-NOTES
index 59796b20a..2ec048505 100644
--- a/RELEASE-NOTES
+++ b/RELEASE-NOTES
@@ -24,6 +24,7 @@ This release includes the following bugfixes:
o builds fine with VC2005
o CURLOPT_RANGE set to NULL resets the range for FTP
o curl_multi_remove_handle() rare crash
+ o passive FTP transfers work with SOCKS
This release includes the following known bugs:
@@ -41,7 +42,7 @@ This release would not have looked like this without help, code, reports and
advice from friends like these:
Yang Tse, Manfred Schwarb, Michael Wallner, Jeff Pohlmeyer, Shmulik Regev,
- Rob Crittenden, Robert A. Monat, Dan Fandrich, Duncan Mac-Vicar Prett,
- Michal Marek
+ Rob Crittenden, Robert A. Monat, Dan Fandrich, Duncan Mac-Vicar Prett,
+ Michal Marek, Robson Braga Araujo
Thanks! (and sorry if I forgot to mention someone)
diff --git a/docs/KNOWN_BUGS b/docs/KNOWN_BUGS
index 3155c45f5..729e321c3 100644
--- a/docs/KNOWN_BUGS
+++ b/docs/KNOWN_BUGS
@@ -64,11 +64,14 @@ may have been fixed since this was written!
"system context" will make it use wrong(?) user name - at least when compared
to what winhttp does. See http://curl.haxx.se/bug/view.cgi?id=1281867
-23. We don't support SOCKS for IPv6. We don't support FTPS over a SOCKS proxy.
- We don't have any test cases for SOCKS proxy. We probably have even more
- bugs and lack of features when a SOCKS proxy is used. And there seem to be a
- problem with SOCKS when doing FTP: See
- http://curl.haxx.se/bug/view.cgi?id=1371540
+23. SOCKS-related problems:
+ A) libcurl doesn't support SOCKS for IPv6.
+ B) libcurl doesn't support FTPS over a SOCKS proxy.
+ C) We don't have any test cases for SOCKS proxy.
+ E) libcurl doesn't support active FTP over a SOCKS proxy
+
+ We probably have even more bugs and lack of features when a SOCKS proxy is
+ used.
22. Sending files to a FTP server using curl on VMS, might lead to curl
complaining on "unaligned file size" on completion. The problem is related
diff --git a/lib/ftp.c b/lib/ftp.c
index e0884437a..28ecdcdc1 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -1737,6 +1737,23 @@ static CURLcode ftp_state_pasv_resp(struct connectdata *conn,
/* this just dumps information about this second connection */
ftp_pasv_verbose(conn, conninfo, newhost, connectport);
+ switch(data->set.proxytype) {
+ case CURLPROXY_SOCKS5:
+ result = Curl_SOCKS5(conn->proxyuser, conn->proxypasswd, newhost, newport,
+ SECONDARYSOCKET, conn);
+ break;
+ case CURLPROXY_HTTP:
+ /* do nothing here. handled later. */
+ break;
+ case CURLPROXY_SOCKS4:
+ result = Curl_SOCKS4(conn->proxyuser, newhost, newport,
+ SECONDARYSOCKET, conn);
+ break;
+ default:
+ failf(data, "unknown proxytype option given");
+ result = CURLE_COULDNT_CONNECT;
+ break;
+ }
#ifndef CURL_DISABLE_HTTP
if(conn->bits.tunnel_proxy && conn->bits.httpproxy) {
/* FIX: this MUST wait for a proper connect first if 'connected' is
diff --git a/lib/socks.c b/lib/socks.c
index b8bda8eeb..accab029b 100644
--- a/lib/socks.c
+++ b/lib/socks.c
@@ -108,12 +108,15 @@ static int blockread_all(struct connectdata *conn, /* connection data */
* Nonsupport "Identification Protocol (RFC1413)"
*/
CURLcode Curl_SOCKS4(const char *proxy_name,
+ char *hostname,
+ int remote_port,
+ int sockindex,
struct connectdata *conn)
{
unsigned char socksreq[262]; /* room for SOCKS4 request incl. user id */
int result;
CURLcode code;
- curl_socket_t sock = conn->sock[FIRSTSOCKET];
+ curl_socket_t sock = conn->sock[sockindex];
long timeout;
struct SessionHandle *data = conn->data;
@@ -146,7 +149,7 @@ CURLcode Curl_SOCKS4(const char *proxy_name,
socksreq[0] = 4; /* version (SOCKS4) */
socksreq[1] = 1; /* connect */
- *((unsigned short*)&socksreq[2]) = htons(conn->remote_port);
+ *((unsigned short*)&socksreq[2]) = htons(remote_port);
/* DNS resolve */
{
@@ -154,7 +157,7 @@ CURLcode Curl_SOCKS4(const char *proxy_name,
Curl_addrinfo *hp=NULL;
int rc;
- rc = Curl_resolv(conn, conn->host.name, (int)conn->remote_port, &dns);
+ rc = Curl_resolv(conn, hostname, remote_port, &dns);
if(rc == CURLRESOLV_ERROR)
return CURLE_COULDNT_RESOLVE_PROXY;
@@ -190,7 +193,7 @@ CURLcode Curl_SOCKS4(const char *proxy_name,
}
if(!hp) {
failf(data, "Failed to resolve \"%s\" for SOCKS4 connect.",
- conn->host.name);
+ hostname);
return CURLE_COULDNT_RESOLVE_HOST;
}
}
@@ -312,6 +315,9 @@ CURLcode Curl_SOCKS4(const char *proxy_name,
*/
CURLcode Curl_SOCKS5(const char *proxy_name,
const char *proxy_password,
+ char *hostname,
+ int remote_port,
+ int sockindex,
struct connectdata *conn)
{
/*
@@ -336,7 +342,7 @@ CURLcode Curl_SOCKS5(const char *proxy_name,
ssize_t written;
int result;
CURLcode code;
- curl_socket_t sock = conn->sock[FIRSTSOCKET];
+ curl_socket_t sock = conn->sock[sockindex];
struct SessionHandle *data = conn->data;
long timeout;
@@ -507,7 +513,7 @@ CURLcode Curl_SOCKS5(const char *proxy_name,
{
struct Curl_dns_entry *dns;
Curl_addrinfo *hp=NULL;
- int rc = Curl_resolv(conn, conn->host.name, (int)conn->remote_port, &dns);
+ int rc = Curl_resolv(conn, hostname, remote_port, &dns);
if(rc == CURLRESOLV_ERROR)
return CURLE_COULDNT_RESOLVE_HOST;
@@ -541,12 +547,12 @@ CURLcode Curl_SOCKS5(const char *proxy_name,
}
if(!hp) {
failf(data, "Failed to resolve \"%s\" for SOCKS5 connect.",
- conn->host.name);
+ hostname);
return CURLE_COULDNT_RESOLVE_HOST;
}
}
- *((unsigned short*)&socksreq[8]) = htons(conn->remote_port);
+ *((unsigned short*)&socksreq[8]) = htons(remote_port);
{
const int packetsize = 10;
diff --git a/lib/socks.h b/lib/socks.h
index 0da987998..471b26224 100644
--- a/lib/socks.h
+++ b/lib/socks.h
@@ -28,6 +28,9 @@
* final destination server.
*/
CURLcode Curl_SOCKS4(const char *proxy_name,
+ char *hostname,
+ int remote_port,
+ int sockindex,
struct connectdata *conn);
/*
@@ -36,6 +39,9 @@ CURLcode Curl_SOCKS4(const char *proxy_name,
*/
CURLcode Curl_SOCKS5(const char *proxy_name,
const char *proxy_password,
+ char *hostname,
+ int remote_port,
+ int sockindex,
struct connectdata *conn);
#endif
diff --git a/lib/url.c b/lib/url.c
index 6d1fa0459..692e66c2d 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -2287,13 +2287,15 @@ static CURLcode ConnectPlease(struct SessionHandle *data,
switch(data->set.proxytype) {
case CURLPROXY_SOCKS5:
- result = Curl_SOCKS5(conn->proxyuser, conn->proxypasswd, conn);
+ result = Curl_SOCKS5(conn->proxyuser, conn->proxypasswd, conn->host.name,
+ conn->remote_port, FIRSTSOCKET, conn);
break;
case CURLPROXY_HTTP:
/* do nothing here. handled later. */
break;
case CURLPROXY_SOCKS4:
- result = Curl_SOCKS4(conn->proxyuser, conn);
+ result = Curl_SOCKS4(conn->proxyuser, conn->host.name, conn->remote_port,
+ FIRSTSOCKET, conn);
break;
default:
failf(data, "unknown proxytype option given");