diff options
author | Daniel Stenberg <daniel@haxx.se> | 2020-03-08 17:24:50 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2020-03-08 17:26:38 +0100 |
commit | 30b0365600d9372c7d19e0a4bb252529a0674d3e (patch) | |
tree | c2e0d4fac13316bb9c44596ba22ffdd6267ce3ff | |
parent | 0a04dc4d5d775402f2e3cdc192c3aadb2e9c4857 (diff) | |
download | curl-bagder/socks4-resolve.tar.gz |
socks: socks4 fix host resolve regressionbagder/socks4-resolve
1. The socks4 state machine was broken in the host resolving phase
2. The code now insists on IPv4-only when using SOCKS4 as the protocol
only supports that.
Regression from #4907 and 4a4b63d, shipped in 7.69.0
Reported-by: amishmm on github
Bug: https://github.com/curl/curl/issues/5053#issuecomment-596191594
-rw-r--r-- | lib/socks.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/socks.c b/lib/socks.c index 754726f6f..37099130e 100644 --- a/lib/socks.c +++ b/lib/socks.c @@ -205,6 +205,8 @@ CURLcode Curl_SOCKS4(const char *proxy_user, switch(sx->state) { case CONNECT_SOCKS_INIT: + /* SOCKS4 can only do IPv4, insist! */ + conn->ip_version = CURL_IPRESOLVE_V4; if(conn->bits.httpproxy) infof(conn->data, "SOCKS4%s: connecting to HTTP proxy %s port %d\n", protocol4a ? "a" : "", hostname, remote_port); @@ -261,8 +263,8 @@ CURLcode Curl_SOCKS4(const char *proxy_user, } else { result = Curl_resolv_check(data->conn, &dns); - /* stay in the state or error out */ - return result; + if(!dns) + return result; } /* FALLTHROUGH */ CONNECT_RESOLVED: |