git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@275511 13f79535-47bb-0310-9956-ffa450edef68master
@@ -53,7 +53,10 @@ jsch-0.1.8.</p> | |||||
</tr> | </tr> | ||||
<tr> | <tr> | ||||
<td valign="top">trust</td> | <td valign="top">trust</td> | ||||
<td valign="top">This trusts all unknown hosts if set to yes/true.</td> | |||||
<td valign="top">This trusts all unknown hosts if set to yes/true.<br> | |||||
<strong>Note</strong> If you set this to false (the default), the | |||||
host you connect to must be listed in your knownhosts file, this | |||||
also implies that the file exists.</td> | |||||
<td valian="top" align="center">No, defaults to No.</td> | <td valian="top" align="center">No, defaults to No.</td> | ||||
</tr> | </tr> | ||||
<tr> | <tr> | ||||
@@ -46,7 +46,11 @@ jsch-0.1.8 and won't work with versions of jsch earlier than | |||||
</tr> | </tr> | ||||
<tr> | <tr> | ||||
<td valign="top">trust</td> | <td valign="top">trust</td> | ||||
<td valign="top">This trusts all unknown hosts if set to yes/true.</td> | |||||
<td valign="top">This trusts all unknown hosts if set to yes/true.<br> | |||||
<strong>Note</strong> If you set this to false (the default), the | |||||
host you connect to must be listed in your knownhosts file, this | |||||
also implies that the file exists.</td> | |||||
<td valian="top" align="center">No, defaults to No.</td> | <td valian="top" align="center">No, defaults to No.</td> | ||||
</tr> | </tr> | ||||
<tr> | <tr> | ||||
@@ -77,7 +77,6 @@ public abstract class SSHBase extends Task implements LogListener { | |||||
private String host; | private String host; | ||||
private String keyfile; | private String keyfile; | ||||
private String knownHosts; | private String knownHosts; | ||||
private boolean trust = false; | |||||
private int port = SSH_PORT; | private int port = SSH_PORT; | ||||
private boolean failOnError = true; | private boolean failOnError = true; | ||||
private SSHUserInfo userInfo; | private SSHUserInfo userInfo; | ||||
@@ -185,7 +184,6 @@ public abstract class SSHBase extends Task implements LogListener { | |||||
public void init() throws BuildException { | public void init() throws BuildException { | ||||
super.init(); | super.init(); | ||||
this.knownHosts = System.getProperty("user.home") + "/.ssh/known_hosts"; | this.knownHosts = System.getProperty("user.home") + "/.ssh/known_hosts"; | ||||
this.trust = false; | |||||
this.port = SSH_PORT; | this.port = SSH_PORT; | ||||
} | } | ||||
@@ -195,7 +193,7 @@ public abstract class SSHBase extends Task implements LogListener { | |||||
jsch.addIdentity(userInfo.getKeyfile()); | jsch.addIdentity(userInfo.getKeyfile()); | ||||
} | } | ||||
if (knownHosts != null) { | |||||
if (!userInfo.getTrust() && knownHosts != null) { | |||||
log("Using known hosts: " + knownHosts, Project.MSG_DEBUG); | log("Using known hosts: " + knownHosts, Project.MSG_DEBUG); | ||||
jsch.setKnownHosts(knownHosts); | jsch.setKnownHosts(knownHosts); | ||||
} | } | ||||
@@ -70,7 +70,7 @@ public class SSHUserInfo implements UserInfo { | |||||
public SSHUserInfo() { | public SSHUserInfo() { | ||||
super(); | super(); | ||||
this.trustAllCertificates = true; | |||||
this.trustAllCertificates = false; | |||||
} | } | ||||
public SSHUserInfo(String password, boolean trustAllCertificates) { | public SSHUserInfo(String password, boolean trustAllCertificates) { | ||||
@@ -146,6 +146,13 @@ public class SSHUserInfo implements UserInfo { | |||||
this.trustAllCertificates = trust; | this.trustAllCertificates = trust; | ||||
} | } | ||||
/** | |||||
* @return whether to trust or not. | |||||
*/ | |||||
public boolean getTrust() { | |||||
return this.trustAllCertificates; | |||||
} | |||||
/** | /** | ||||
* Returns the passphrase. | * Returns the passphrase. | ||||
* @return String | * @return String | ||||