You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mod_ftp-commits@incubator.apache.org by wr...@apache.org on 2007/02/06 05:17:24 UTC

svn commit: r503990 - /incubator/mod_ftp/trunk/modules/ftp/ftp_commands.c

Author: wrowe
Date: Mon Feb  5 21:17:23 2007
New Revision: 503990

URL: http://svn.apache.org/viewvc?view=rev&rev=503990
Log:

  [Possibly] short term hackery around IPv6MappedIPv4 addresses, which gets
  us past 0.0.0.0 errors, but leaves open the deep question of what address
  do we suggest they PASV into.

  Acutally the first exceptional IPv6 case in the 1418 logic block does make
  some sense, since they could be facing an adapter where we have set up
  the FTPPasvBind address in IPv4 notation, and the connection would succeed.

  The second exceptional case makes nearly no sense whatsoever, since we aren't
  looking at a legitimate IPv4 or IPv6 control channel connection.

Modified:
    incubator/mod_ftp/trunk/modules/ftp/ftp_commands.c

Modified: incubator/mod_ftp/trunk/modules/ftp/ftp_commands.c
URL: http://svn.apache.org/viewvc/incubator/mod_ftp/trunk/modules/ftp/ftp_commands.c?view=diff&rev=503990&r1=503989&r2=503990
==============================================================================
--- incubator/mod_ftp/trunk/modules/ftp/ftp_commands.c (original)
+++ incubator/mod_ftp/trunk/modules/ftp/ftp_commands.c Mon Feb  5 21:17:23 2007
@@ -1414,8 +1414,6 @@
         return FTP_REPLY_CANNOT_OPEN_DATACONN;
     }
 
-    apr_socket_addr_get(&sa, APR_LOCAL, s);
-
     if (fsc->pasv_bindaddr) {
         apr_sockaddr_info_get(&sa, fsc->pasv_bindaddr, APR_INET,
                               0, 0, c->pool);
@@ -1424,6 +1422,19 @@
         apr_sockaddr_info_get(&sa, c->local_ip, APR_INET,
                               0, 0, c->pool);
     }
+#if APR_HAVE_IPV6
+    else if (c->local_addr->family == AF_INET6 &&
+        IN6_IS_ADDR_V4MAPPED((struct in6_addr *)c->local_addr->ipaddr_ptr)) {
+         /* httpd assures us local_ip is in ipv4 notation for mapped addrs */
+        apr_sockaddr_info_get(&sa, c->local_ip, APR_INET,
+                              0, 0, c->pool);
+    }
+    else if (c->local_addr->family == AF_INET6) {
+        apr_sockaddr_info_get(&sa, c->local_ip, APR_INET6,
+                              0, 0, c->pool);
+        /* XXX: Really this is bogus and perhaps should simply fail */
+    }
+#endif
     else {
         /* XXX: The code below is wrong since the 'null' address 
          * will be 0,0,0,0 not an explicit address.  We MUST resolve
@@ -1431,6 +1442,7 @@
          */
         apr_sockaddr_info_get(&sa, NULL, APR_INET,
                               0, 0, c->pool);
+        /* XXX: Perhaps we should simply fail? */
     }
 
     found_port = 0;
@@ -1504,7 +1516,7 @@
         a = apr_pstrdup(c->pool, fsc->pasv_bindaddr);
     }
     else {
-        apr_sockaddr_ip_get(&a, sa);
+        a = apr_pstrdup(c->pool, c->local_ip);
     }
 
     /* Translate x.x.x.x to x,x,x,x */