8abab90
Index: modules/mod_core.c
8abab90
===================================================================
8abab90
RCS file: /cvsroot/proftp/proftpd/modules/mod_core.c,v
8abab90
retrieving revision 1.420
8abab90
diff -u -r1.420 mod_core.c
8abab90
--- modules/mod_core.c	5 Feb 2012 18:08:56 -0000	1.420
8abab90
+++ modules/mod_core.c	5 Feb 2012 18:24:16 -0000
8abab90
@@ -3587,6 +3587,27 @@
8abab90
   }
8abab90
 
8abab90
   if (pr_netaddr_get_family(session.c->local_addr) == pr_netaddr_get_family(session.c->remote_addr)) {
8abab90
+
8abab90
+#ifdef PR_USE_IPV6
8abab90
+    if (pr_netaddr_use_ipv6()) {
8abab90
+      /* Make sure that the family is NOT IPv6, even though the family of the
8abab90
+       * local and remote ends match.  The PASV command cannot be used for
8abab90
+       * IPv6 addresses (Bug#3745).
8abab90
+       */
8abab90
+      if (pr_netaddr_get_family(session.c->local_addr) == AF_INET6) {
8abab90
+        int xerrno = EPERM;
8abab90
+
8abab90
+        pr_log_debug(DEBUG0,
8abab90
+          "Unable to handle PASV for IPv6 address '%s', rejecting command",
8abab90
+          pr_netaddr_get_ipstr(session.c->local_addr));
8abab90
+        pr_response_add_err(R_501, "%s: %s", cmd->argv[0], strerror(xerrno));
8abab90
+
8abab90
+        errno = xerrno;
8abab90
+        return PR_ERROR(cmd);
8abab90
+      }
8abab90
+    }
8abab90
+#endif /* PR_USE_IPV6 */
8abab90
+
8abab90
     bind_addr = session.c->local_addr;
8abab90
 
8abab90
   } else {