Revert "Revert "Upgrade mina-sshd to 2.4.0"" 99/92299/1
authorRobert Varga <robert.varga@pantheon.tech>
Wed, 26 Aug 2020 18:30:07 +0000 (20:30 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 26 Aug 2020 18:30:32 +0000 (20:30 +0200)
This reverts commit f25f45ff27c8a7c7df780df609ec33f6662ea61e,
re-bumping to 2.5.1.

JIRA: NETCONF-716
Change-Id: I520d807c50a8107c0189745cf56e0fbc75871230
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
netconf/mdsal-netconf-ssh/src/main/java/org/opendaylight/netconf/ssh/RemoteNetconfCommand.java
netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/NetconfSshClient.java
netconf/shaded-sshd-jar/pom.xml

index ed557f0b627d254ca29622e4642f717c5c3bb64a..d9ef852404eeaa11df5248841eb95ecceb558643 100644 (file)
@@ -21,7 +21,6 @@ import java.io.OutputStream;
 import java.net.InetSocketAddress;
 import java.net.SocketAddress;
 import org.opendaylight.netconf.api.messages.NetconfHelloMessageAdditionalHeader;
-import org.opendaylight.netconf.shaded.sshd.common.NamedFactory;
 import org.opendaylight.netconf.shaded.sshd.common.io.IoInputStream;
 import org.opendaylight.netconf.shaded.sshd.common.io.IoOutputStream;
 import org.opendaylight.netconf.shaded.sshd.server.Environment;
@@ -30,6 +29,7 @@ import org.opendaylight.netconf.shaded.sshd.server.channel.ChannelSession;
 import org.opendaylight.netconf.shaded.sshd.server.command.AsyncCommand;
 import org.opendaylight.netconf.shaded.sshd.server.command.Command;
 import org.opendaylight.netconf.shaded.sshd.server.session.ServerSession;
+import org.opendaylight.netconf.shaded.sshd.server.subsystem.SubsystemFactory;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -163,7 +163,7 @@ public class RemoteNetconfCommand implements AsyncCommand {
         return netconfHelloMessageAdditionalHeader.getAddress();
     }
 
-    public static class NetconfCommandFactory implements NamedFactory<Command> {
+    public static class NetconfCommandFactory implements SubsystemFactory {
 
         public static final String NETCONF = "netconf";
 
@@ -182,7 +182,7 @@ public class RemoteNetconfCommand implements AsyncCommand {
         }
 
         @Override
-        public RemoteNetconfCommand create() {
+        public Command createSubsystem(final ChannelSession channel) {
             return new RemoteNetconfCommand(clientBootstrap, localAddress);
         }
     }
index 7b5308a36f3d544cc6f15941237f81a765c7d921..d5d0d97aa955636191257b0ef4e8e792fbb1a9ae 100644 (file)
@@ -10,8 +10,6 @@ package org.opendaylight.netconf.nettyutil.handler.ssh.client;
 import com.google.common.annotations.Beta;
 import org.opendaylight.netconf.shaded.sshd.client.SshClient;
 import org.opendaylight.netconf.shaded.sshd.common.Factory;
-import org.opendaylight.netconf.shaded.sshd.common.forward.PortForwardingEventListener;
-import org.opendaylight.netconf.shaded.sshd.common.util.net.SshdSocketAddress;
 
 /**
  * An extension to {@link SshClient} which uses {@link NetconfSessionFactory} to create sessions (leading towards
@@ -21,22 +19,6 @@ import org.opendaylight.netconf.shaded.sshd.common.util.net.SshdSocketAddress;
 public class NetconfSshClient extends SshClient {
     public static final Factory<SshClient> DEFAULT_NETCONF_SSH_CLIENT_FACTORY = NetconfSshClient::new;
 
-    /*
-     * This is a workaround for sshd-core's instantiation of Proxies. AbstractFactoryManager (which is our superclass)
-     * is calling Proxy.newProxyInstance() with getClass().getClassLoader(), i.e. our class loader.
-     *
-     * Since we are not using PortForwardingEventListener, our classloader does not see it (because we do not import
-     * that package), which leads to an instantiation failure.
-     *
-     * Having these dumb fields alleviates the problem, as it forces the packages to be imported by our bundle.
-     *
-     * FIXME: Remove this once we have an SSHD version with  https://issues.apache.org/jira/browse/SSHD-975 fixed
-     */
-    static final class Sshd975Workarounds {
-        static final PortForwardingEventListener PFEL = null;
-        static final SshdSocketAddress SSA = null;
-    }
-
     @Override
     protected NetconfSessionFactory createSessionFactory() {
         return new NetconfSessionFactory(this);
index 6593881495b6dc2b29362231e90c8bfb1daef9cf..8f5e1167838ac3008cb06063d1c5afbf14411885 100644 (file)
         <dependency>
             <groupId>org.apache.sshd</groupId>
             <artifactId>sshd-osgi</artifactId>
+            <version>2.5.1</version>
         </dependency>
         <dependency>
             <groupId>org.apache.sshd</groupId>
             <artifactId>sshd-netty</artifactId>
+            <version>2.5.1</version>
         </dependency>
         <dependency>
             <groupId>net.i2p.crypto</groupId>