From f48d2abcba7b96f986171db51942d91fa275a980 Mon Sep 17 00:00:00 2001 From: ShadelessFox Date: Tue, 14 Mar 2023 00:17:24 +0100 Subject: [PATCH 1/7] dbeaver/dbeaver#17537 Make it a drop-in replacement for Eclipse version --- pom.xml | 5 +++-- src/main/java/com/jcraft/jsch/AgentIdentityRepository.java | 2 +- src/main/java/com/jcraft/jsch/ChannelAgentForwarding.java | 2 ++ src/main/java/com/jcraft/jsch/IdentityRepository.java | 3 ++- .../java/com/jcraft/jsch/IdentityRepositoryWrapper.java | 6 +++--- src/main/java/com/jcraft/jsch/JSch.java | 2 ++ src/main/java/com/jcraft/jsch/LocalIdentityRepository.java | 2 +- src/main/java/com/jcraft/jsch/UserAuthPublicKey.java | 1 + src/test/java/com/jcraft/jsch/KeyPair2Test.java | 2 +- src/test/java/com/jcraft/jsch/KeyPairTest.java | 2 +- 10 files changed, 17 insertions(+), 10 deletions(-) diff --git a/pom.xml b/pom.xml index afd4966a..24a7da5a 100644 --- a/pom.xml +++ b/pom.xml @@ -1,9 +1,9 @@ 4.0.0 - com.github.mwiede + com.jcraft jsch jar - 0.2.8-SNAPSHOT + 0.2.2 JSch https://github.com/mwiede/jsch JSch is a pure Java implementation of SSH2 @@ -389,6 +389,7 @@ com.jcraft.jsch + com.sun.jna, com.sun.jna.platform diff --git a/src/main/java/com/jcraft/jsch/AgentIdentityRepository.java b/src/main/java/com/jcraft/jsch/AgentIdentityRepository.java index c4e25168..51c3d7b2 100644 --- a/src/main/java/com/jcraft/jsch/AgentIdentityRepository.java +++ b/src/main/java/com/jcraft/jsch/AgentIdentityRepository.java @@ -37,7 +37,7 @@ public AgentIdentityRepository(AgentConnector connector) { } @Override - public Vector getIdentities() { + public Vector getIdentities() { return agent.getIdentities(); } diff --git a/src/main/java/com/jcraft/jsch/ChannelAgentForwarding.java b/src/main/java/com/jcraft/jsch/ChannelAgentForwarding.java index 64d788f2..a7a233f0 100644 --- a/src/main/java/com/jcraft/jsch/ChannelAgentForwarding.java +++ b/src/main/java/com/jcraft/jsch/ChannelAgentForwarding.java @@ -128,6 +128,7 @@ void write(byte[] foo, int s, int l) throws IOException { if (typ == SSH2_AGENTC_REQUEST_IDENTITIES) { mbuf.putByte(SSH2_AGENT_IDENTITIES_ANSWER); + @SuppressWarnings("unchecked") Vector identities = irepo.getIdentities(); synchronized (identities) { int count = 0; @@ -158,6 +159,7 @@ void write(byte[] foo, int s, int l) throws IOException { // datafellows = SSH_BUG_SIGBLOB; // } + @SuppressWarnings("unchecked") Vector identities = irepo.getIdentities(); Identity identity = null; synchronized (identities) { diff --git a/src/main/java/com/jcraft/jsch/IdentityRepository.java b/src/main/java/com/jcraft/jsch/IdentityRepository.java index cc0a91ce..58addd27 100644 --- a/src/main/java/com/jcraft/jsch/IdentityRepository.java +++ b/src/main/java/com/jcraft/jsch/IdentityRepository.java @@ -37,7 +37,8 @@ public interface IdentityRepository { public int getStatus(); - public Vector getIdentities(); + @SuppressWarnings("rawtypes") + public Vector getIdentities(); public boolean add(byte[] identity); diff --git a/src/main/java/com/jcraft/jsch/IdentityRepositoryWrapper.java b/src/main/java/com/jcraft/jsch/IdentityRepositoryWrapper.java index 73b7e711..795c01b2 100644 --- a/src/main/java/com/jcraft/jsch/IdentityRepositoryWrapper.java +++ b/src/main/java/com/jcraft/jsch/IdentityRepositoryWrapper.java @@ -74,13 +74,13 @@ public void removeAll() { } @Override - public Vector getIdentities() { - Vector result = new Vector<>(); + public Vector getIdentities() { + Vector result = new Vector<>(); for (int i = 0; i < cache.size(); i++) { Identity identity = cache.elementAt(i); result.add(identity); } - Vector tmp = ir.getIdentities(); + Vector tmp = ir.getIdentities(); for (int i = 0; i < tmp.size(); i++) { result.add(tmp.elementAt(i)); } diff --git a/src/main/java/com/jcraft/jsch/JSch.java b/src/main/java/com/jcraft/jsch/JSch.java index d70f964e..01657c7f 100644 --- a/src/main/java/com/jcraft/jsch/JSch.java +++ b/src/main/java/com/jcraft/jsch/JSch.java @@ -555,6 +555,7 @@ public void addIdentity(Identity identity, byte[] passphrase) throws JSchExcepti */ @Deprecated public void removeIdentity(String name) throws JSchException { + @SuppressWarnings("unchecked") Vector identities = identityRepository.getIdentities(); for (int i = 0; i < identities.size(); i++) { Identity identity = identities.elementAt(i); @@ -587,6 +588,7 @@ public void removeIdentity(Identity identity) throws JSchException { */ public Vector getIdentityNames() throws JSchException { Vector foo = new Vector<>(); + @SuppressWarnings("unchecked") Vector identities = identityRepository.getIdentities(); for (int i = 0; i < identities.size(); i++) { Identity identity = identities.elementAt(i); diff --git a/src/main/java/com/jcraft/jsch/LocalIdentityRepository.java b/src/main/java/com/jcraft/jsch/LocalIdentityRepository.java index 81e8cd74..8daf3860 100644 --- a/src/main/java/com/jcraft/jsch/LocalIdentityRepository.java +++ b/src/main/java/com/jcraft/jsch/LocalIdentityRepository.java @@ -49,7 +49,7 @@ public int getStatus() { } @Override - public synchronized Vector getIdentities() { + public synchronized Vector getIdentities() { removeDupulicates(); Vector v = new Vector<>(); for (int i = 0; i < identities.size(); i++) { diff --git a/src/main/java/com/jcraft/jsch/UserAuthPublicKey.java b/src/main/java/com/jcraft/jsch/UserAuthPublicKey.java index 5cffe35a..8ab97c1c 100644 --- a/src/main/java/com/jcraft/jsch/UserAuthPublicKey.java +++ b/src/main/java/com/jcraft/jsch/UserAuthPublicKey.java @@ -34,6 +34,7 @@ class UserAuthPublicKey extends UserAuth { public boolean start(Session session) throws Exception { super.start(session); + @SuppressWarnings("unchecked") Vector identities = session.getIdentityRepository().getIdentities(); synchronized (identities) { diff --git a/src/test/java/com/jcraft/jsch/KeyPair2Test.java b/src/test/java/com/jcraft/jsch/KeyPair2Test.java index c5dd4782..99b95e58 100644 --- a/src/test/java/com/jcraft/jsch/KeyPair2Test.java +++ b/src/test/java/com/jcraft/jsch/KeyPair2Test.java @@ -50,6 +50,6 @@ void loadKey(String path, String password, String keyType) jSch.addIdentity(prvkey); } }); - assertEquals(keyType, jSch.getIdentityRepository().getIdentities().get(0).getAlgName()); + assertEquals(keyType, ((Identity) jSch.getIdentityRepository().getIdentities().get(0)).getAlgName()); } } diff --git a/src/test/java/com/jcraft/jsch/KeyPairTest.java b/src/test/java/com/jcraft/jsch/KeyPairTest.java index 43fb4dc9..084a5eae 100644 --- a/src/test/java/com/jcraft/jsch/KeyPairTest.java +++ b/src/test/java/com/jcraft/jsch/KeyPairTest.java @@ -126,7 +126,7 @@ void loadKey(String path, String password, String keyType) jSch.addIdentity(prvkey); } }); - assertEquals(keyType, jSch.getIdentityRepository().getIdentities().get(0).getAlgName()); + assertEquals(keyType, ((Identity) jSch.getIdentityRepository().getIdentities().get(0)).getAlgName()); } @Test From a4aaf83a3eb40e2cb55cad38f072d8f2d3417c63 Mon Sep 17 00:00:00 2001 From: ShadelessFox Date: Tue, 14 Mar 2023 15:17:59 +0100 Subject: [PATCH 2/7] dbeaver/dbeaver#17537 Disable formatter and checkstyle --- pom.xml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 24a7da5a..57f89f4a 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ com.jcraft jsch jar - 0.2.2 + 0.2.4 JSch https://github.com/mwiede/jsch JSch is a pure Java implementation of SSH2 @@ -559,6 +559,7 @@ maven-dependency-plugin 3.5.0 + org.jacoco jacoco-maven-plugin @@ -708,6 +710,7 @@ + From 59e09a1bcd1ee4aebcd8375c99fc906291e5234a Mon Sep 17 00:00:00 2001 From: ShadelessFox Date: Thu, 16 Mar 2023 14:54:31 +0100 Subject: [PATCH 3/7] dbeaver/dbeaver#17537 Include `junixsocket` in the build --- pom.xml | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 57f89f4a..6c221fb5 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ com.jcraft jsch jar - 0.2.4 + 0.2.5 JSch https://github.com/mwiede/jsch JSch is a pure Java implementation of SSH2 @@ -90,7 +90,6 @@ com.kohlschutter.junixsocket junixsocket-common ${junixsocket.version} - true net.java.dev.jna @@ -155,7 +154,6 @@ com.kohlschutter.junixsocket junixsocket-native-common ${junixsocket.version} - test com.google.guava @@ -616,6 +614,27 @@ + + org.apache.maven.plugins + maven-shade-plugin + 3.4.1 + + + package + + shade + + + + + com.kohlschutter.junixsocket:junixsocket-common + com.kohlschutter.junixsocket:junixsocket-native-common + + + + + + From a54e1ea44e90624bd31668e88617fed3b56d45f3 Mon Sep 17 00:00:00 2001 From: ShadelessFox Date: Fri, 17 Mar 2023 13:56:50 +0100 Subject: [PATCH 4/7] dbeaver/dbeaver#17537 Exclude unnecessary library versions --- pom.xml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pom.xml b/pom.xml index 6c221fb5..7a87f38e 100644 --- a/pom.xml +++ b/pom.xml @@ -631,6 +631,15 @@ com.kohlschutter.junixsocket:junixsocket-native-common + + + com.kohlschutter.junixsocket:* + + lib/**/*.dll + lib/**/*.nodeps.so + + + From e9b2de78c44f171770a2451c4271e616915eaaa1 Mon Sep 17 00:00:00 2001 From: ShadelessFox Date: Fri, 17 Mar 2023 16:59:01 +0100 Subject: [PATCH 5/7] dbeaver/dbeaver#17537 Exclude imported packages --- pom.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 7a87f38e..f67d05ad 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ com.jcraft jsch jar - 0.2.5 + 0.2.6 JSch https://github.com/mwiede/jsch JSch is a pure Java implementation of SSH2 @@ -386,6 +386,7 @@ 5.1.8 + com.jcraft.jsch com.sun.jna, com.sun.jna.platform From 69ced4685cfaf37cb5b409cc3ca88cbbfcdacaf0 Mon Sep 17 00:00:00 2001 From: Georgii Gvinepadze Date: Tue, 4 Apr 2023 13:25:25 +0400 Subject: [PATCH 6/7] dbeaver/dbeaver#18348-add-legacy-algorithms --- pom.xml | 2 +- src/main/java/com/jcraft/jsch/JSch.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 77d65a6c..36787022 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.jcraft jsch jar - 0.2.6 + 0.2.7 JSch https://github.com/mwiede/jsch JSch is a pure Java implementation of SSH2 diff --git a/src/main/java/com/jcraft/jsch/JSch.java b/src/main/java/com/jcraft/jsch/JSch.java index 01657c7f..963c1f03 100644 --- a/src/main/java/com/jcraft/jsch/JSch.java +++ b/src/main/java/com/jcraft/jsch/JSch.java @@ -42,7 +42,7 @@ public class JSch { config.put("kex", Util.getSystemProperty("jsch.kex", "curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256")); config.put("server_host_key", Util.getSystemProperty("jsch.server_host_key", - "ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,rsa-sha2-512,rsa-sha2-256")); + "ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,rsa-sha2-512,rsa-sha2-256,ssh-rsa")); config.put("prefer_known_host_key_types", Util.getSystemProperty("jsch.prefer_known_host_key_types", "yes")); config.put("enable_server_sig_algs", @@ -222,7 +222,7 @@ public class JSch { config.put("PreferredAuthentications", Util.getSystemProperty("jsch.preferred_authentications", "gssapi-with-mic,publickey,keyboard-interactive,password")); config.put("PubkeyAcceptedAlgorithms", Util.getSystemProperty("jsch.client_pubkey", - "ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,rsa-sha2-512,rsa-sha2-256")); + "ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,rsa-sha2-512,rsa-sha2-256,ssh-rsa")); config.put("enable_pubkey_auth_query", Util.getSystemProperty("jsch.enable_pubkey_auth_query", "yes")); config.put("try_additional_pubkey_algorithms", From cc8a9a3a4ab610970fa272efb15abbbf867697a2 Mon Sep 17 00:00:00 2001 From: Georgii Date: Wed, 7 Jun 2023 16:15:27 +0400 Subject: [PATCH 7/7] dbeaver/pro#1683 add import package to osgi gen (#2) * dbeaver/pro#1683 add import package to osgi gen * dbeaver/pro#1683 remove explicit versions --- pom.xml | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 36787022..6b36e786 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.jcraft jsch jar - 0.2.7 + 0.2.8 JSch https://github.com/mwiede/jsch JSch is a pure Java implementation of SSH2 @@ -389,8 +389,23 @@ 5.1.8 - - com.jcraft.jsch + com.jcraft.jsch;-noimport:=true + + <_nouses>true + com.sun.jna, com.sun.jna.platform