Skip to content

Commit

Permalink
Merge pull request #475 from Alex-Vol-Amz/upgrade-jsch-library
Browse files Browse the repository at this point in the history
Switch uses of JSch library to the com.github.mwiede:jsch fork
  • Loading branch information
tomaswolf authored Apr 2, 2024
2 parents 2b3b15c + 6b2a873 commit 283c8d4
Show file tree
Hide file tree
Showing 12 changed files with 22 additions and 61 deletions.
9 changes: 2 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -504,14 +504,9 @@
</dependency>

<dependency>
<groupId>com.jcraft</groupId>
<groupId>com.github.mwiede</groupId>
<artifactId>jsch</artifactId>
<version>0.1.55</version>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jzlib</artifactId>
<version>1.1.3</version>
<version>0.2.17</version>
</dependency>

<!-- Transitive dependencies by various 3rd party packages -->
Expand Down
7 changes: 1 addition & 6 deletions sshd-cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,10 @@
</dependency>

<dependency>
<groupId>com.jcraft</groupId>
<groupId>com.github.mwiede</groupId>
<artifactId>jsch</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jzlib</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
9 changes: 3 additions & 6 deletions sshd-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,10 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<groupId>com.github.mwiede</groupId>
<artifactId>jsch</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jzlib</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
Expand Down Expand Up @@ -246,6 +241,8 @@
<configuration>
<reportsDirectory>${project.build.directory}/surefire-reports-jce</reportsDirectory>
<systemProperties>
<!-- Enable using deprecated ssh-rsa signature keys with JSch 0.2.x -->
<jsch.server_host_key>ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,rsa-sha2-512,rsa-sha2-256,ssh-rsa</jsch.server_host_key>
<org.apache.sshd.security.provider.BC.enabled>false</org.apache.sshd.security.provider.BC.enabled>
<!-- deprecated -->
<org.apache.sshd.registerBouncyCastle>false</org.apache.sshd.registerBouncyCastle>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ public void setUp() throws Exception {
String name = factory.getName();
JSch.setConfig("compression.s2c", name);
JSch.setConfig("compression.c2s", name);
JSch.setConfig("zlib", com.jcraft.jsch.jcraft.Compression.class.getName());
JSch.setConfig("zlib@openssh.com", com.jcraft.jsch.jcraft.Compression.class.getName());
JSch.setConfig("zlib", com.jcraft.jsch.jzlib.Compression.class.getName());
JSch.setConfig("zlib@openssh.com", com.jcraft.jsch.jzlib.Compression.class.getName());
}

@After
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,10 @@ public void showMessage(String s) {
session.connect();
} catch (JSchException e) {
String reason = e.getMessage();
switch (reason) {
case "Auth cancel":
case "Auth fail":
return false;
default:
throw e;
if (reason != null && (reason.startsWith("Auth cancel") || reason.startsWith("Auth fail"))) {
return false;
}
throw e;
}

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
*/
package org.apache.sshd.server.auth;

import java.util.Objects;

import com.jcraft.jsch.ChannelShell;
import com.jcraft.jsch.JSch;
import com.jcraft.jsch.JSchException;
Expand Down Expand Up @@ -86,7 +84,7 @@ public void showMessage(String s) {
session.connect();
} catch (JSchException e) {
String reason = e.getMessage();
if (Objects.equals(reason, "Auth cancel")) {
if (reason != null && reason.startsWith("Auth cancel")) {
return false;
} else {
throw e;
Expand Down
2 changes: 1 addition & 1 deletion sshd-git/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<groupId>com.github.mwiede</groupId>
<artifactId>jsch</artifactId>
<scope>test</scope>
</dependency>
Expand Down
7 changes: 1 addition & 6 deletions sshd-mina/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,10 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<groupId>com.github.mwiede</groupId>
<artifactId>jsch</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jzlib</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
Expand Down
7 changes: 1 addition & 6 deletions sshd-netty/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,10 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<groupId>com.github.mwiede</groupId>
<artifactId>jsch</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jzlib</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
Expand Down
9 changes: 3 additions & 6 deletions sshd-scp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<groupId>com.github.mwiede</groupId>
<artifactId>jsch</artifactId>
<scope>test</scope>
</dependency>
Expand All @@ -65,11 +65,6 @@
<artifactId>ganymed-ssh2</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jzlib</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
Expand Down Expand Up @@ -105,6 +100,8 @@
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<reportsDirectory>${project.build.directory}/surefire-reports-nio2</reportsDirectory>
<systemProperties>
<!-- Enable using deprecated ssh-rsa signature keys with JSch 0.2.x -->
<jsch.server_host_key>ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,rsa-sha2-512,rsa-sha2-256,ssh-rsa</jsch.server_host_key>
<org.apache.sshd.common.io.IoServiceFactoryFactory>org.apache.sshd.common.io.nio2.Nio2ServiceFactoryFactory</org.apache.sshd.common.io.IoServiceFactoryFactory>
</systemProperties>
</configuration>
Expand Down
9 changes: 3 additions & 6 deletions sshd-sftp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,10 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<groupId>com.github.mwiede</groupId>
<artifactId>jsch</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jzlib</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
Expand Down Expand Up @@ -112,6 +107,8 @@
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<reportsDirectory>${project.build.directory}/surefire-reports-nio2</reportsDirectory>
<systemProperties>
<!-- Enable using deprecated ssh-rsa signature keys with JSch 0.2.x -->
<jsch.server_host_key>ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,rsa-sha2-512,rsa-sha2-256,ssh-rsa</jsch.server_host_key>
<org.apache.sshd.common.io.IoServiceFactoryFactory>org.apache.sshd.common.io.nio2.Nio2ServiceFactoryFactory</org.apache.sshd.common.io.IoServiceFactoryFactory>
</systemProperties>
</configuration>
Expand Down
7 changes: 1 addition & 6 deletions sshd-spring-sftp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,10 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<groupId>com.github.mwiede</groupId>
<artifactId>jsch</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jzlib</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.sshd</groupId>
<artifactId>sshd-core</artifactId>
Expand Down

0 comments on commit 283c8d4

Please sign in to comment.