Browse Source

add docs for #170 and make host name check strict by default

master
Stefan Bodewig 3 years ago
parent
commit
43214e4332
3 changed files with 26 additions and 12 deletions
  1. +3
    -0
      WHATSNEW
  2. +7
    -0
      manual/Tasks/ftp.html
  3. +16
    -12
      src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java

+ 3
- 0
WHATSNEW View File

@@ -13,6 +13,9 @@ Other changes:
of the generated output file from the listener. of the generated output file from the listener.
Github Pull Request #168 Github Pull Request #168


* <ftp> now supports FTPs.
Github Pull Request #170

Changes from Ant 1.10.11 TO Ant 1.10.12 Changes from Ant 1.10.11 TO Ant 1.10.12
======================================= =======================================




+ 7
- 0
manual/Tasks/ftp.html View File

@@ -346,6 +346,13 @@ connection.</p>
the <var>serverLanguageCode</var> attribute.<br/><em>Since Ant 1.7</em></td> the <var>serverLanguageCode</var> attribute.<br/><em>Since Ant 1.7</em></td>
<td>No</td> <td>No</td>
</tr> </tr>
<tr>
<td>useFtps</td>
<td>Whether to use ftps instead of ftp. Boolean, defauls
to <var>false</var>.<br/>
<em>Since Ant 1.10.13</em></td>
<td>No</td>
</tr>
</table> </table>
<h3>Note about <var>remotedir</var> attribute</h3> <h3>Note about <var>remotedir</var> attribute</h3>
<table> <table>


+ 16
- 12
src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java View File

@@ -115,7 +115,7 @@ public class FTP extends Task implements FTPTaskConfig {
private String userid; private String userid;
private String password; private String password;
private String account; private String account;
private boolean useFtps =false;
private boolean useFtps = false;
private HostnameVerifier hostnameVerifier; private HostnameVerifier hostnameVerifier;
private File listing; private File listing;
private boolean binary = true; private boolean binary = true;
@@ -1268,15 +1268,16 @@ public class FTP extends Task implements FTPTaskConfig {
this.userid = userid; this.userid = userid;
} }


/**
* Whether to use ftps instead of ftp.
*
* @since 1.10.13
*/
public void setUseFtps(boolean useFtps) { public void setUseFtps(boolean useFtps) {
this.useFtps = useFtps; this.useFtps = useFtps;
} }


public HostnameVerifier getHostnameVerifier() {
return hostnameVerifier;
}

public void setHostnameVerifier(HostnameVerifier hostnameVerifier) {
public void add(HostnameVerifier hostnameVerifier) {
this.hostnameVerifier = hostnameVerifier; this.hostnameVerifier = hostnameVerifier;
} }


@@ -2517,13 +2518,16 @@ public class FTP extends Task implements FTPTaskConfig {
FTPClient ftp = null; FTPClient ftp = null;


try { try {
log("Opening FTP connection to " + server, Project.MSG_VERBOSE);
if( useFtps) {
ftp = new FTPSClient();
if(hostnameVerifier != null){
((FTPSClient)ftp).setHostnameVerifier(hostnameVerifier);
if (useFtps) {
log("Opening FTPs connection to " + server, Project.MSG_VERBOSE);
FTPSClient ftps = new FTPSClient();
ftps.setEndpointCheckingEnabled(true);
if (hostnameVerifier != null) {
ftps.setHostnameVerifier(hostnameVerifier);
} }
}else{
ftp = ftps;
} else {
log("Opening FTP connection to " + server, Project.MSG_VERBOSE);
ftp = new FTPClient(); ftp = new FTPClient();
} }
if (this.isConfigurationSet) { if (this.isConfigurationSet) {


Loading…
Cancel
Save