This is an automated email from the ASF dual-hosted git repository.

lahirujayathilake pushed a commit to branch agent-framewok-refactoring
in repository https://gitbox.apache.org/repos/asf/airavata.git


The following commit(s) were added to refs/heads/agent-framewok-refactoring by 
this push:
     new b9d7420d85 updated the sshj library version
b9d7420d85 is described below

commit b9d7420d8511993d93e61cfc597275f164530909
Author: lahiruj <[email protected]>
AuthorDate: Wed Nov 27 01:19:49 2024 -0500

    updated the sshj library version
---
 .../airavata-helix/agent-impl/sshj-agent/pom.xml   |  2 +-
 .../airavata/helix/adaptor/SSHJAgentAdaptor.java   | 25 +++++++++++++++++++++-
 .../adaptor/wrapper/SCPFileTransferWrapper.java    | 20 +++++++++++++++++
 3 files changed, 45 insertions(+), 2 deletions(-)

diff --git a/modules/airavata-helix/agent-impl/sshj-agent/pom.xml 
b/modules/airavata-helix/agent-impl/sshj-agent/pom.xml
index 886a2536f9..ae604de3f1 100644
--- a/modules/airavata-helix/agent-impl/sshj-agent/pom.xml
+++ b/modules/airavata-helix/agent-impl/sshj-agent/pom.xml
@@ -34,7 +34,7 @@
         <dependency>
             <groupId>com.hierynomus</groupId>
             <artifactId>sshj</artifactId>
-            <version>0.23.0</version>
+            <version>0.39.0</version>
         </dependency>
         <dependency>
             <groupId>org.apache.airavata</groupId>
diff --git 
a/modules/airavata-helix/agent-impl/sshj-agent/src/main/java/org/apache/airavata/helix/adaptor/SSHJAgentAdaptor.java
 
b/modules/airavata-helix/agent-impl/sshj-agent/src/main/java/org/apache/airavata/helix/adaptor/SSHJAgentAdaptor.java
index 79a7dfca96..ebc65548bb 100644
--- 
a/modules/airavata-helix/agent-impl/sshj-agent/src/main/java/org/apache/airavata/helix/adaptor/SSHJAgentAdaptor.java
+++ 
b/modules/airavata-helix/agent-impl/sshj-agent/src/main/java/org/apache/airavata/helix/adaptor/SSHJAgentAdaptor.java
@@ -25,6 +25,7 @@ import net.schmizz.sshj.DefaultConfig;
 import net.schmizz.sshj.connection.ConnectionException;
 import net.schmizz.sshj.connection.channel.direct.Session;
 import net.schmizz.sshj.sftp.*;
+import net.schmizz.sshj.transport.verification.HostKeyVerifier;
 import net.schmizz.sshj.userauth.keyprovider.KeyProvider;
 import net.schmizz.sshj.userauth.method.AuthKeyboardInteractive;
 import net.schmizz.sshj.userauth.method.AuthMethod;
@@ -51,6 +52,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import java.io.*;
+import java.security.PublicKey;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -65,7 +67,18 @@ public class SSHJAgentAdaptor implements AgentAdaptor {
         defaultConfig.setKeepAliveProvider(KeepAliveProvider.KEEP_ALIVE);
 
         sshjClient = new PoolingSSHJClient(defaultConfig, host, port == 0 ? 22 
: port);
-        sshjClient.addHostKeyVerifier((h, p, key) -> true);
+        sshjClient.addHostKeyVerifier(new HostKeyVerifier() {
+
+            @Override
+            public boolean verify(String hostname, int port, PublicKey key) {
+                return true;
+            }
+
+            @Override
+            public List<String> findExistingAlgorithms(String hostname, int 
port) {
+                return Collections.emptyList();
+            }
+        });
 
         sshjClient.setMaxSessionsForConnection(1);
 
@@ -363,11 +376,21 @@ public class SSHJAgentAdaptor implements AgentAdaptor {
         try {
             fileTransfer = sshjClient.newSCPFileTransferWrapper();
             fileTransfer.download(remoteFile, new LocalDestFile() {
+                @Override
+                public long getLength() {
+                    return metadata.getSize();
+                }
+
                 @Override
                 public OutputStream getOutputStream() throws IOException {
                     return localOutStream;
                 }
 
+                @Override
+                public OutputStream getOutputStream(boolean append) throws 
IOException {
+                    return localOutStream;
+                }
+
                 @Override
                 public LocalDestFile getChild(String name) {
                     return null;
diff --git 
a/modules/airavata-helix/agent-impl/sshj-agent/src/main/java/org/apache/airavata/helix/adaptor/wrapper/SCPFileTransferWrapper.java
 
b/modules/airavata-helix/agent-impl/sshj-agent/src/main/java/org/apache/airavata/helix/adaptor/wrapper/SCPFileTransferWrapper.java
index 2aaad74b72..9131207a11 100644
--- 
a/modules/airavata-helix/agent-impl/sshj-agent/src/main/java/org/apache/airavata/helix/adaptor/wrapper/SCPFileTransferWrapper.java
+++ 
b/modules/airavata-helix/agent-impl/sshj-agent/src/main/java/org/apache/airavata/helix/adaptor/wrapper/SCPFileTransferWrapper.java
@@ -46,21 +46,41 @@ public class SCPFileTransferWrapper implements 
FileTransfer, Closeable {
         scpFileTransfer.upload(localPath, remotePath);
     }
 
+    @Override
+    public void upload(String localPath, String remotePath, long byteOffset) 
throws IOException {
+        scpFileTransfer.upload(localPath, remotePath, byteOffset);
+    }
+
     @Override
     public void download(String remotePath, String localPath) throws 
IOException {
         scpFileTransfer.download(remotePath, localPath);
     }
 
+    @Override
+    public void download(String remotePath, String localPath, long byteOffset) 
throws IOException {
+        scpFileTransfer.download(remotePath, localPath, byteOffset);
+    }
+
     @Override
     public void upload(LocalSourceFile localFile, String remotePath) throws 
IOException {
         scpFileTransfer.upload(localFile, remotePath);
     }
 
+    @Override
+    public void upload(LocalSourceFile localFile, String remotePath, long 
byteOffset) throws IOException {
+        scpFileTransfer.upload(localFile, remotePath, byteOffset);
+    }
+
     @Override
     public void download(String remotePath, LocalDestFile localFile) throws 
IOException {
         scpFileTransfer.download(remotePath, localFile);
     }
 
+    @Override
+    public void download(String remotePath, LocalDestFile localFile, long 
byteOffset) throws IOException {
+        scpFileTransfer.download(remotePath, localFile, byteOffset);
+    }
+
     @Override
     public TransferListener getTransferListener() {
         return scpFileTransfer.getTransferListener();

Reply via email to