camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r893075 - in /camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote: SftpConfiguration.java SftpOperations.java
Date Tue, 22 Dec 2009 05:40:36 GMT
Author: davsclaus
Date: Tue Dec 22 05:40:35 2009
New Revision: 893075

URL: http://svn.apache.org/viewvc?rev=893075&view=rev
Log:
CAMEL-2308: Added option strictHostKeyChecking to SFTP consumer.

Modified:
    camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpConfiguration.java
    camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java

Modified: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpConfiguration.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpConfiguration.java?rev=893075&r1=893074&r2=893075&view=diff
==============================================================================
--- camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpConfiguration.java
(original)
+++ camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpConfiguration.java
Tue Dec 22 05:40:35 2009
@@ -27,6 +27,7 @@
     private String knownHostsFile;
     private String privateKeyFile;
     private String privateKeyFilePassphrase;
+    private String strictHostKeyChecking = "no";
 
     public SftpConfiguration() {
         setProtocol("sftp");
@@ -64,4 +65,12 @@
     public void setPrivateKeyFilePassphrase(String privateKeyFilePassphrase) {
         this.privateKeyFilePassphrase = privateKeyFilePassphrase;
     }
+
+    public String getStrictHostKeyChecking() {
+        return strictHostKeyChecking;
+    }
+
+    public void setStrictHostKeyChecking(String strictHostKeyChecking) {
+        this.strictHostKeyChecking = strictHostKeyChecking;
+    }
 }

Modified: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java?rev=893075&r1=893074&r2=893075&view=diff
==============================================================================
--- camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java
(original)
+++ camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java
Tue Dec 22 05:40:35 2009
@@ -132,6 +132,13 @@
         }
 
         final Session session = jsch.getSession(configuration.getUsername(), configuration.getHost(),
configuration.getPort());
+
+        if (isNotEmpty(sftpConfig.getStrictHostKeyChecking())) {
+            LOG.debug("Using StrickHostKeyChecking: " + sftpConfig.getStrictHostKeyChecking());
+            session.setConfig("StrictHostKeyChecking", sftpConfig.getStrictHostKeyChecking());
+        }
+
+        // set user information
         session.setUserInfo(new UserInfo() {
             public String getPassphrase() {
                 return null;
@@ -150,12 +157,13 @@
             }
 
             public boolean promptYesNo(String s) {
-                LOG.error(s);
+                LOG.warn("Server asks for confirmation (yes|no): " + s + ". Camel will answer
no.");
                 // Return 'false' indicating modification of the hosts file is disabled.
                 return false;
             }
 
             public void showMessage(String s) {
+                LOG.trace("Message received from Server: " + s);
             }
         });
         return session;



Mime
View raw message