From a0e5b158cf8e86b8bda5ba136641be537d104dae Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Mon, 14 Jul 2008 14:31:25 +0000 Subject: [PATCH] allow ftp remote verification to be disabled. PR 35471. Suggested by Viacheslav Garmash. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@676603 13f79535-47bb-0310-9956-ffa450edef68 --- WHATSNEW | 3 +++ docs/manual/OptionalTasks/ftp.html | 11 ++++++++++- .../apache/tools/ant/taskdefs/optional/net/FTP.java | 13 +++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/WHATSNEW b/WHATSNEW index b2bfba5b0..ac3811256 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -162,6 +162,9 @@ Other changes: * 's logging has been improved. Bugzilla reports 30932, 31743. + * It is now possible to disable 's remote verification. + Bugzilla report 35471. + Changes from Ant 1.7.0 TO Ant 1.7.1 ============================================= diff --git a/docs/manual/OptionalTasks/ftp.html b/docs/manual/OptionalTasks/ftp.html index 77681cd5d..c8bad3ad6 100644 --- a/docs/manual/OptionalTasks/ftp.html +++ b/docs/manual/OptionalTasks/ftp.html @@ -243,9 +243,18 @@ try to set up a new connection.

initialSiteCommand Set a server-specific SITE command to execute immediately - after login. + after login. No + + enableRemoteVerification + Whether data connection sshould be verified to + connect to the same host as the control connection. This is a + security measure that is enabled by default, but it may be useful + to disable it in certain firewall scenarios. + since Ant 1.8.0 + No, default is true + diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java b/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java index 05bf500aa..00f282b31 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java @@ -136,6 +136,7 @@ public class FTP private int retriesAllowed = 0; private String siteCommand = null; private String initialSiteCommand = null; + private boolean enableRemoteVerification = true; protected static final String[] ACTION_STRS = { "sending", @@ -1487,6 +1488,17 @@ public class FTP public void setInitialSiteCommand(String initialCommand) { this.initialSiteCommand = initialCommand; } + + /** + * Whether to verify that data and control connections are + * connected to the same remote host. + * + * @since Ant 1.8.0 + */ + public void setEnableRemoteVerification(boolean b) { + enableRemoteVerification = b; + } + /** * Checks to see that all required parameters are set. * @@ -2282,6 +2294,7 @@ public class FTP ftp = FTPConfigurator.configure(ftp, this); } + ftp.setRemoteVerificationEnabled(enableRemoteVerification); ftp.connect(server, port); if (!FTPReply.isPositiveCompletion(ftp.getReplyCode())) { throw new BuildException("FTP connection failed: "