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 2006/12/15 21:54:41 UTC

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

Author: wrowe
Date: Fri Dec 15 13:54:40 2006
New Revision: 487680

URL: http://svn.apache.org/viewvc?view=rev&rev=487680
Log:
FTPPASVaddr MUST be respected and reported before any actual IP address used.

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=487680&r1=487679&r2=487680
==============================================================================
--- incubator/mod_ftp/trunk/modules/ftp/ftp_commands.c (original)
+++ incubator/mod_ftp/trunk/modules/ftp/ftp_commands.c Fri Dec 15 13:54:40 2006
@@ -1423,9 +1423,9 @@
                               0, 0, c->pool);
     }
     else {
-        /* XXX: this code above doesn't correspond to fsc->pasv_addr
-         * logic below.  The code below is wrong since the 'null'
-         * address will be 0,0,0,0 not an explicit address.  Bleh
+        /* XXX: The code below is wrong since the 'null' address 
+         * will be 0,0,0,0 not an explicit address.  We MUST resolve
+         * 0.0.0.0 to an explicit port in the IPv4 provider list.
          */
         apr_sockaddr_info_get(&sa, NULL, APR_INET,
                               0, 0, c->pool);
@@ -1490,11 +1490,16 @@
     }
 
     apr_socket_addr_get(&sa, APR_LOCAL, s);
-    if (fsc->pasv_bindaddr) {
-        a = apr_pstrdup(c->pool, fsc->pasv_bindaddr);
-    }
-    else if (fsc->pasv_addr) {
+
+    /* pasv_addr is an ADVERTISED address, not related to the true
+     * address.  It should always be evaluated first for the benefit
+     * of servers hiding behind load balancers, vpn's, nat, etc.
+     */
+    if (fsc->pasv_addr) {
         a = apr_pstrdup(c->pool, fsc->pasv_addr);
+    }
+    else if (fsc->pasv_bindaddr) {
+        a = apr_pstrdup(c->pool, fsc->pasv_bindaddr);
     }
     else {
         apr_sockaddr_ip_get(&a, sa);