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/14 21:34:04 UTC

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

Author: wrowe
Date: Thu Dec 14 13:34:04 2006
New Revision: 487356

URL: http://svn.apache.org/viewvc?view=rev&rev=487356
Log:
Solve the explicit IPv4 code, still a todo here if anyone
cares to jump on it.

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=487356&r1=487355&r2=487356
==============================================================================
--- incubator/mod_ftp/trunk/modules/ftp/ftp_commands.c (original)
+++ incubator/mod_ftp/trunk/modules/ftp/ftp_commands.c Thu Dec 14 13:34:04 2006
@@ -1415,12 +1415,20 @@
     apr_socket_addr_get(&sa, APR_LOCAL, s);
 
     if (fsc->pasv_bindaddr) {
-        apr_sockaddr_info_get(&sa, fsc->pasv_bindaddr, sa->family,
-                              0, APR_IPV4_ADDR_OK, r->pool);
+        apr_sockaddr_info_get(&sa, fsc->pasv_bindaddr, APR_INET,
+                              0, 0, r->pool);
+    }
+    else if (c->local_addr->family == APR_INET) {
+        apr_sockaddr_info_get(&sa, c->local_ip, APR_INET,
+                              0, 0, r->pool);
     }
     else {
-        apr_sockaddr_info_get(&sa, c->local_ip, sa->family,
-                              0, APR_IPV4_ADDR_OK, r->pool);
+        /* 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
+         */
+        apr_sockaddr_info_get(&sa, NULL, APR_INET,
+                              0, 0, r->pool);
     }
 
     found_port = 0;
@@ -1627,8 +1635,14 @@
         sa->port = 0;
     }
 
-    apr_sockaddr_info_get(&sa, c->local_ip, sa->family,
-                          sa->port, APR_IPV4_ADDR_OK, r->pool);
+    if (c->local_addr->family == APR_INET) {
+        apr_sockaddr_info_get(&sa, c->local_ip, APR_INET,
+                              sa->port, 0, r->pool);
+    }
+    else {
+        apr_sockaddr_info_get(&sa, NULL, APR_INET,
+                              sa->port, 0, r->pool);
+    }
     apr_socket_opt_set(s, APR_SO_REUSEADDR, 1);
     rv = apr_socket_bind(s, sa);
 
@@ -1645,8 +1659,8 @@
     }
 
     apr_socket_addr_get(&fc->clientsa, APR_LOCAL, s);
-    apr_sockaddr_info_get(&fc->clientsa, ip_addr, fc->clientsa->family,
-                          port, APR_IPV4_ADDR_OK, r->pool);
+    apr_sockaddr_info_get(&fc->clientsa, ip_addr, APR_INET,
+                          port, 0, r->pool);
 
     fc->response_notes = apr_psprintf(r->pool, FTP_MSG_SUCCESS, r->method);
     fc->passive_created = -1; /* Redundant but just for clarity */