Hi,
  I'm sending a patch that fixes this bug:

TL;DR: when an EPVS reply comes from an FTP server on a link-local IPv6 address, curl won't pass the scope ID necessary for a link-local IPv6 connection to the new connection info.

For more information see my bugreport: (Note that I initially incorrectly blamed PASV handling, see later comment.)

https://sourceforge.net/p/curl/bugs/1468/

Someone also seems to have ran into the same problem a while back here:

http://curl.haxx.se/mail/archive-2012-01/0045.html

The attached patch fixes the problem in a very simple way: In EPSV handling, the original hostname is simply copied and resolved again when the data connection is being established. It is the same code as if there was a proxy so I simply merged the two branches. I'm not sure it's okay to have the hostname resolved again - let me know if not.

(Also, it might be a good idea not to fallback to PASV on IPv6 since PASV is technically illegal on IPv6.)

Best Regards,
Vojtech Kral
diff --git a/lib/ftp.c b/lib/ftp.c
index 2f4351e..62f7bff 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -1948,19 +1948,7 @@ static CURLcode ftp_state_pasv_resp(struct connectdata *conn,
         }
         if(ptr) {
           ftpc->newport = (unsigned short)(num & 0xffff);
-
-          if(conn->bits.tunnel_proxy ||
-             conn->proxytype == CURLPROXY_SOCKS5 ||
-             conn->proxytype == CURLPROXY_SOCKS5_HOSTNAME ||
-             conn->proxytype == CURLPROXY_SOCKS4 ||
-             conn->proxytype == CURLPROXY_SOCKS4A)
-            /* proxy tunnel -> use other host info because ip_addr_str is the
-               proxy address not the ftp host */
-            snprintf(ftpc->newhost, sizeof(ftpc->newhost), "%s",
-                     conn->host.name);
-          else
-            /* use the same IP we are already connected to */
-            snprintf(ftpc->newhost, NEWHOST_BUFSIZE, "%s", conn->ip_addr_str);
+          snprintf(ftpc->newhost, sizeof(ftpc->newhost), "%s", conn->host.name);
         }
       }
       else
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Reply via email to