Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2018-11-06 19:05:41 +0000
committerAlexander Kurtakov2018-11-06 19:52:09 +0000
commitd20c25bdf0dbd2870db041b2d7774e54af1589ed (patch)
treefdf3cc412e66e29efc18e1b5667a4e18ab1ceda5
parent8c56fc88e37b1524182fdf0b28177dfd00e6183a (diff)
downloadrt.equinox.bundles-d20c25bdf0dbd2870db041b2d7774e54af1589ed.tar.gz
rt.equinox.bundles-d20c25bdf0dbd2870db041b2d7774e54af1589ed.tar.xz
rt.equinox.bundles-d20c25bdf0dbd2870db041b2d7774e54af1589ed.zip
Bug 540728 - Migrate to latest org.apache.sshd from Orbit
Migrate to compile against Mina SSHd 2.0. Change-Id: I2e154df9064ce79d55869e95f4ab16b6ef10c769 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
-rwxr-xr-xbundles/archived/org.eclipse.equinox.console.ssh.tests/META-INF/MANIFEST.MF3
-rwxr-xr-xbundles/archived/org.eclipse.equinox.console.ssh.tests/src/org/eclipse/equinox/console/ssh/SshCommandTests.java20
-rwxr-xr-xbundles/archived/org.eclipse.equinox.console.ssh.tests/src/org/eclipse/equinox/console/ssh/SshCommandWithConfigAdminTests.java25
-rwxr-xr-xbundles/archived/org.eclipse.equinox.console.ssh.tests/src/org/eclipse/equinox/console/ssh/SshShellTests.java3
-rwxr-xr-xbundles/archived/org.eclipse.equinox.console.ssh.tests/src/org/eclipse/equinox/console/ssh/UserAdminCommandTests.java3
-rw-r--r--bundles/org.eclipse.equinox.console.ssh/META-INF/MANIFEST.MF19
-rw-r--r--bundles/org.eclipse.equinox.console.ssh/src/org/eclipse/equinox/console/internal/ssh/AuthorizedKeysFileAuthenticator.java2
-rw-r--r--bundles/org.eclipse.equinox.console.ssh/src/org/eclipse/equinox/console/ssh/SshServ.java12
-rwxr-xr-xbundles/org.eclipse.equinox.console.ssh/src/org/eclipse/equinox/console/ssh/SshShell.java2
-rwxr-xr-xbundles/org.eclipse.equinox.console.ssh/src/org/eclipse/equinox/console/ssh/SshShellFactory.java2
10 files changed, 40 insertions, 51 deletions
diff --git a/bundles/archived/org.eclipse.equinox.console.ssh.tests/META-INF/MANIFEST.MF b/bundles/archived/org.eclipse.equinox.console.ssh.tests/META-INF/MANIFEST.MF
index 3fe896ac..cbf90ad2 100755
--- a/bundles/archived/org.eclipse.equinox.console.ssh.tests/META-INF/MANIFEST.MF
+++ b/bundles/archived/org.eclipse.equinox.console.ssh.tests/META-INF/MANIFEST.MF
@@ -7,6 +7,9 @@ Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: junit.framework;version="4.8.1",
org.apache.sshd.client.future,
+ org.apache.sshd.client,
+ org.apache.sshd.client.session,
+ org.apache.sshd.client.channel,
org.easymock;version="2.4.0",
org.junit;version="4.8.1"
Fragment-Host: org.eclipse.equinox.console.ssh, org.eclipse.equinox.console
diff --git a/bundles/archived/org.eclipse.equinox.console.ssh.tests/src/org/eclipse/equinox/console/ssh/SshCommandTests.java b/bundles/archived/org.eclipse.equinox.console.ssh.tests/src/org/eclipse/equinox/console/ssh/SshCommandTests.java
index d22978ac..64a87e2d 100755
--- a/bundles/archived/org.eclipse.equinox.console.ssh.tests/src/org/eclipse/equinox/console/ssh/SshCommandTests.java
+++ b/bundles/archived/org.eclipse.equinox.console.ssh.tests/src/org/eclipse/equinox/console/ssh/SshCommandTests.java
@@ -25,9 +25,9 @@ import java.util.Map;
import org.apache.felix.service.command.CommandProcessor;
import org.apache.felix.service.command.CommandSession;
-import org.apache.sshd.ClientChannel;
-import org.apache.sshd.ClientSession;
-import org.apache.sshd.SshClient;
+import org.apache.sshd.client.channel.ClientChannel;
+import org.apache.sshd.client.session.ClientSession;
+import org.apache.sshd.client.SshClient;
import org.apache.sshd.client.future.ConnectFuture;
import org.apache.sshd.client.future.DefaultConnectFuture;
import org.apache.sshd.server.Environment;
@@ -75,8 +75,7 @@ public class SshCommandTests {
public void testSshCommand() throws Exception {
CommandSession session = EasyMock.createMock(CommandSession.class);
EasyMock.makeThreadSafe(session, true);
- session.put((String)EasyMock.anyObject(), EasyMock.anyObject());
- EasyMock.expectLastCall().times(5);
+ EasyMock.expect(session.put((String)EasyMock.anyObject(), EasyMock.anyObject())).andReturn(new Object());
EasyMock.expect(session.execute(GOGO_SHELL_COMMAND)).andReturn(null);
session.close();
EasyMock.expectLastCall();
@@ -106,7 +105,7 @@ public class SshCommandTests {
SshClient client = SshClient.setUpDefaultClient();
client.start();
try {
- ConnectFuture connectFuture = client.connect(HOST, SSH_PORT);
+ ConnectFuture connectFuture = client.connect(USERNAME, HOST, SSH_PORT);
DefaultConnectFuture defaultConnectFuture = (DefaultConnectFuture) connectFuture;
try {
@@ -116,14 +115,7 @@ public class SshCommandTests {
}
ClientSession sshSession = defaultConnectFuture.getSession();
- int ret = ClientSession.WAIT_AUTH;
- sshSession.authPassword(USERNAME, PASSWORD);
- ret = sshSession.waitFor(ClientSession.WAIT_AUTH | ClientSession.CLOSED | ClientSession.AUTHED, 0);
-
- if ((ret & ClientSession.CLOSED) != 0) {
- System.err.println("error");
- System.exit(-1);
- }
+ sshSession.addPasswordIdentity(PASSWORD);
ClientChannel channel = sshSession.createChannel("shell");
channel.setIn(new StringBufferInputStream(TEST_CONTENT + "\n"));
ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
diff --git a/bundles/archived/org.eclipse.equinox.console.ssh.tests/src/org/eclipse/equinox/console/ssh/SshCommandWithConfigAdminTests.java b/bundles/archived/org.eclipse.equinox.console.ssh.tests/src/org/eclipse/equinox/console/ssh/SshCommandWithConfigAdminTests.java
index 9585dcd3..465b3efd 100755
--- a/bundles/archived/org.eclipse.equinox.console.ssh.tests/src/org/eclipse/equinox/console/ssh/SshCommandWithConfigAdminTests.java
+++ b/bundles/archived/org.eclipse.equinox.console.ssh.tests/src/org/eclipse/equinox/console/ssh/SshCommandWithConfigAdminTests.java
@@ -27,9 +27,9 @@ import java.util.Map;
import org.apache.felix.service.command.CommandProcessor;
import org.apache.felix.service.command.CommandSession;
-import org.apache.sshd.ClientChannel;
-import org.apache.sshd.ClientSession;
-import org.apache.sshd.SshClient;
+import org.apache.sshd.client.channel.ClientChannel;
+import org.apache.sshd.client.session.ClientSession;
+import org.apache.sshd.client.SshClient;
import org.apache.sshd.client.future.ConnectFuture;
import org.apache.sshd.client.future.DefaultConnectFuture;
import org.apache.sshd.common.RuntimeSshException;
@@ -89,8 +89,7 @@ public class SshCommandWithConfigAdminTests {
CommandSession session = EasyMock.createMock(CommandSession.class);
EasyMock.makeThreadSafe(session, true);
- session.put((String)EasyMock.anyObject(), EasyMock.anyObject());
- EasyMock.expectLastCall().times(5);
+ EasyMock.expect(session.put((String)EasyMock.anyObject(), EasyMock.anyObject())).andReturn(EasyMock.anyObject()).times(5);
EasyMock.expect(session.execute(GOGO_SHELL_COMMAND)).andReturn(null);
session.close();
EasyMock.expectLastCall();
@@ -143,7 +142,7 @@ public class SshCommandWithConfigAdminTests {
SshClient client = SshClient.setUpDefaultClient();
client.start();
try {
- ConnectFuture connectFuture = client.connect(HOST, Integer.valueOf(SSH_PORT));
+ ConnectFuture connectFuture = client.connect(USERNAME, HOST, Integer.valueOf(SSH_PORT));
DefaultConnectFuture defaultConnectFuture = (DefaultConnectFuture) connectFuture;
try {
@@ -153,14 +152,7 @@ public class SshCommandWithConfigAdminTests {
}
ClientSession sshSession = defaultConnectFuture.getSession();
- int ret = ClientSession.WAIT_AUTH;
- sshSession.authPassword(USERNAME, PASSWORD);
- ret = sshSession.waitFor(ClientSession.WAIT_AUTH | ClientSession.CLOSED | ClientSession.AUTHED, 0);
-
- if ((ret & ClientSession.CLOSED) != 0) {
- System.err.println("error");
- System.exit(-1);
- }
+ sshSession.addPasswordIdentity(PASSWORD);
ClientChannel channel = sshSession.createChannel("shell");
channel.setIn(new StringBufferInputStream(TEST_CONTENT + "\n"));
ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
@@ -195,8 +187,7 @@ public class SshCommandWithConfigAdminTests {
private void testDisabled(boolean isDefault) throws Exception {
CommandSession session = EasyMock.createMock(CommandSession.class);
- session.put((String)EasyMock.anyObject(), EasyMock.anyObject());
- EasyMock.expectLastCall().times(4);
+ EasyMock.expect(session.put((String)EasyMock.anyObject(), EasyMock.anyObject())).andReturn(EasyMock.anyObject()).times(4);
EasyMock.expect(session.execute(GOGO_SHELL_COMMAND)).andReturn(null);
session.close();
EasyMock.expectLastCall();
@@ -250,7 +241,7 @@ public class SshCommandWithConfigAdminTests {
SshClient client = SshClient.setUpDefaultClient();
client.start();
try {
- ConnectFuture connectFuture = client.connect(HOST, Integer.valueOf(SSH_PORT));
+ ConnectFuture connectFuture = client.connect("", HOST, Integer.valueOf(SSH_PORT));
DefaultConnectFuture defaultConnectFuture = (DefaultConnectFuture) connectFuture;
try {
diff --git a/bundles/archived/org.eclipse.equinox.console.ssh.tests/src/org/eclipse/equinox/console/ssh/SshShellTests.java b/bundles/archived/org.eclipse.equinox.console.ssh.tests/src/org/eclipse/equinox/console/ssh/SshShellTests.java
index c6ffb9b8..463f6cb3 100755
--- a/bundles/archived/org.eclipse.equinox.console.ssh.tests/src/org/eclipse/equinox/console/ssh/SshShellTests.java
+++ b/bundles/archived/org.eclipse.equinox.console.ssh.tests/src/org/eclipse/equinox/console/ssh/SshShellTests.java
@@ -76,8 +76,7 @@ public class SshShellTests {
CommandSession session = EasyMock.createMock(CommandSession.class);
EasyMock.makeThreadSafe(session, true);
- session.put((String)EasyMock.anyObject(), EasyMock.anyObject());
- EasyMock.expectLastCall().times(5);
+ EasyMock.expect(session.put((String)EasyMock.anyObject(), EasyMock.anyObject())).andReturn(EasyMock.anyObject());
EasyMock.expect(session.execute(GOGO_SHELL_COMMAND)).andReturn(null);
session.close();
EasyMock.expectLastCall();
diff --git a/bundles/archived/org.eclipse.equinox.console.ssh.tests/src/org/eclipse/equinox/console/ssh/UserAdminCommandTests.java b/bundles/archived/org.eclipse.equinox.console.ssh.tests/src/org/eclipse/equinox/console/ssh/UserAdminCommandTests.java
index 60db8331..522b8246 100755
--- a/bundles/archived/org.eclipse.equinox.console.ssh.tests/src/org/eclipse/equinox/console/ssh/UserAdminCommandTests.java
+++ b/bundles/archived/org.eclipse.equinox.console.ssh.tests/src/org/eclipse/equinox/console/ssh/UserAdminCommandTests.java
@@ -55,8 +55,7 @@ public class UserAdminCommandTests {
SecureUserStore.initStorage();
CommandSession session = EasyMock.createMock(CommandSession.class);
- session.put((String)EasyMock.anyObject(), EasyMock.anyObject());
- EasyMock.expectLastCall().times(3);
+ EasyMock.expect(session.put((String)EasyMock.anyObject(), EasyMock.anyObject())).andReturn(new Object()).times(3);
EasyMock.replay(session);
UserAdminCommand command = new UserAdminCommand();
diff --git a/bundles/org.eclipse.equinox.console.ssh/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.console.ssh/META-INF/MANIFEST.MF
index 174f7396..37dd4386 100644
--- a/bundles/org.eclipse.equinox.console.ssh/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.console.ssh/META-INF/MANIFEST.MF
@@ -14,17 +14,20 @@ Import-Package: javax.security.auth;resolution:=optional,
javax.security.auth.spi;resolution:=optional,
org.apache.felix.service.command;status=provisional;version="0.8.0",
org.apache.mina.util;version="2.0.0";resolution:=optional,
- org.apache.sshd;version="0.5.0";resolution:=optional,
- org.apache.sshd.common;version="0.5.0";resolution:=optional,
- org.apache.sshd.server;version="0.5.0";resolution:=optional,
- org.apache.sshd.server.jaas;version="0.5.0";resolution:=optional,
- org.apache.sshd.server.keyprovider;version="0.5.0";resolution:=optional,
- org.apache.sshd.server.session;version="0.5.0";resolution:=optional,
- org.apache.sshd.server.shell;version="0.5.0";resolution:=optional,
+ org.apache.sshd.common;version="2.0.0";resolution:=optional,
+ org.apache.sshd.common.kex;version="2.0.0";resolution:=optional,
+ org.apache.sshd.common.keyprovider;version="2.0.0";resolution:=optional,
+ org.apache.sshd.server;version="2.0.0";resolution:=optional,
+ org.apache.sshd.server.auth.password;version="2.0.0";resolution:=optional,
+ org.apache.sshd.server.auth.pubkey;version="2.0.0";resolution:=optional,
+ org.apache.sshd.server.command;version="2.0.0";resolution:=optional,
+ org.apache.sshd.server.jaas;version="2.0.0";resolution:=optional,
+ org.apache.sshd.server.keyprovider;version="2.0.0";resolution:=optional,
+ org.apache.sshd.server.session;version="2.0.0";resolution:=optional,
org.eclipse.equinox.console.common,
org.eclipse.equinox.console.common.terminal,
org.osgi.framework,
- org.osgi.service.cm; version="[1.4, 2.0)"; resolution:=optional,
+ org.osgi.service.cm;version="[1.4,2.0)";resolution:=optional,
org.osgi.util.tracker
Export-Package: org.eclipse.equinox.console.internal.ssh;x-internal:=true,
org.eclipse.equinox.console.jaas,
diff --git a/bundles/org.eclipse.equinox.console.ssh/src/org/eclipse/equinox/console/internal/ssh/AuthorizedKeysFileAuthenticator.java b/bundles/org.eclipse.equinox.console.ssh/src/org/eclipse/equinox/console/internal/ssh/AuthorizedKeysFileAuthenticator.java
index eefbdefa..4f5db767 100644
--- a/bundles/org.eclipse.equinox.console.ssh/src/org/eclipse/equinox/console/internal/ssh/AuthorizedKeysFileAuthenticator.java
+++ b/bundles/org.eclipse.equinox.console.ssh/src/org/eclipse/equinox/console/internal/ssh/AuthorizedKeysFileAuthenticator.java
@@ -19,7 +19,7 @@ import java.security.PublicKey;
import java.security.interfaces.DSAPublicKey;
import java.security.interfaces.RSAPublicKey;
-import org.apache.sshd.server.PublickeyAuthenticator;
+import org.apache.sshd.server.auth.pubkey.PublickeyAuthenticator;
import org.apache.sshd.server.session.ServerSession;
/**
diff --git a/bundles/org.eclipse.equinox.console.ssh/src/org/eclipse/equinox/console/ssh/SshServ.java b/bundles/org.eclipse.equinox.console.ssh/src/org/eclipse/equinox/console/ssh/SshServ.java
index de7354f9..542b79eb 100644
--- a/bundles/org.eclipse.equinox.console.ssh/src/org/eclipse/equinox/console/ssh/SshServ.java
+++ b/bundles/org.eclipse.equinox.console.ssh/src/org/eclipse/equinox/console/ssh/SshServ.java
@@ -15,6 +15,8 @@
package org.eclipse.equinox.console.ssh;
import java.io.IOException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
import java.security.PublicKey;
import java.util.List;
@@ -25,9 +27,9 @@ import org.osgi.framework.InvalidSyntaxException;
import org.osgi.framework.ServiceReference;
import org.apache.felix.service.command.CommandProcessor;
-import org.apache.sshd.SshServer;
-import org.apache.sshd.server.PasswordAuthenticator;
-import org.apache.sshd.server.PublickeyAuthenticator;
+import org.apache.sshd.server.SshServer;
+import org.apache.sshd.server.auth.password.PasswordAuthenticator;
+import org.apache.sshd.server.auth.pubkey.PublickeyAuthenticator;
import org.apache.sshd.server.jaas.JaasPasswordAuthenticator;
import org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider;
import org.apache.sshd.server.session.ServerSession;
@@ -64,7 +66,7 @@ public class SshServ extends Thread {
sshServer.setHost(host);
}
sshServer.setPort(port);
- sshServer.setKeyPairProvider(new SimpleGeneratorHostKeyProvider(System.getProperty(SSH_KEYSTORE_PROP, SSH_KEYSTORE_PROP_DEFAULT)));
+ sshServer.setKeyPairProvider(new SimpleGeneratorHostKeyProvider(Paths.get(System.getProperty(SSH_KEYSTORE_PROP, SSH_KEYSTORE_PROP_DEFAULT))));
sshServer.setShellFactory(shellFactory);
sshServer.setPasswordAuthenticator(createJaasPasswordAuthenticator());
sshServer.setPublickeyAuthenticator(createSimpleAuthorizedKeysAuthenticator());
@@ -79,7 +81,7 @@ public class SshServ extends Thread {
public synchronized void stopSshServer() {
try {
sshServer.stop(true);
- } catch (InterruptedException e) {
+ } catch (IOException e) {
e.printStackTrace();
}
}
diff --git a/bundles/org.eclipse.equinox.console.ssh/src/org/eclipse/equinox/console/ssh/SshShell.java b/bundles/org.eclipse.equinox.console.ssh/src/org/eclipse/equinox/console/ssh/SshShell.java
index 460cb996..a212df42 100755
--- a/bundles/org.eclipse.equinox.console.ssh/src/org/eclipse/equinox/console/ssh/SshShell.java
+++ b/bundles/org.eclipse.equinox.console.ssh/src/org/eclipse/equinox/console/ssh/SshShell.java
@@ -23,7 +23,7 @@ import java.util.List;
import java.util.Map;
import org.apache.felix.service.command.CommandProcessor;
-import org.apache.sshd.server.Command;
+import org.apache.sshd.server.command.Command;
import org.apache.sshd.server.Environment;
import org.apache.sshd.server.ExitCallback;
import org.eclipse.equinox.console.common.KEYS;
diff --git a/bundles/org.eclipse.equinox.console.ssh/src/org/eclipse/equinox/console/ssh/SshShellFactory.java b/bundles/org.eclipse.equinox.console.ssh/src/org/eclipse/equinox/console/ssh/SshShellFactory.java
index 76e78d8a..5a9e31d4 100755
--- a/bundles/org.eclipse.equinox.console.ssh/src/org/eclipse/equinox/console/ssh/SshShellFactory.java
+++ b/bundles/org.eclipse.equinox.console.ssh/src/org/eclipse/equinox/console/ssh/SshShellFactory.java
@@ -20,7 +20,7 @@ import java.util.Set;
import org.apache.felix.service.command.CommandProcessor;
import org.apache.sshd.common.Factory;
-import org.apache.sshd.server.Command;
+import org.apache.sshd.server.command.Command;
import org.osgi.framework.BundleContext;
/**

Back to the top