SshDaemon: Install unknown channel reference handler

Since SSHD 1.7.0 unknown channel reference should be provided, otherwise
session can crash, see this SSHD issue for more details: [1].

[1] https://issues.apache.org/jira/browse/SSHD-942

Bug: Issue 11491
Change-Id: Ic3d5f86ead0cf9669a3d73d6822ccd8b86114607
This commit is contained in:
David Ostrovsky
2019-09-20 14:00:41 +02:00
parent fbbc6d5983
commit 0326b5dd14

View File

@@ -89,6 +89,7 @@ import org.apache.sshd.common.random.Random;
import org.apache.sshd.common.random.SingletonRandomFactory;
import org.apache.sshd.common.session.ConnectionService;
import org.apache.sshd.common.session.Session;
import org.apache.sshd.common.session.helpers.DefaultUnknownChannelReferenceHandler;
import org.apache.sshd.common.util.buffer.Buffer;
import org.apache.sshd.common.util.buffer.ByteArrayBuffer;
import org.apache.sshd.common.util.net.SshdSocketAddress;
@@ -226,6 +227,7 @@ public class SshDaemon extends SshServer implements SshInfo, LifecycleListener {
initMacs(cfg);
initSignatures();
initChannels();
initUnknownChannelReferenceHandler();
initForwarding();
initFileSystemFactory();
initSubsystems();
@@ -653,6 +655,10 @@ public class SshDaemon extends SshServer implements SshInfo, LifecycleListener {
setChannelFactories(ServerBuilder.DEFAULT_CHANNEL_FACTORIES);
}
private void initUnknownChannelReferenceHandler() {
setUnknownChannelReferenceHandler(DefaultUnknownChannelReferenceHandler.INSTANCE);
}
private void initSubsystems() {
setSubsystemFactories(Collections.<NamedFactory<Command>>emptyList());
}