From 9343b80b545c4befb0d20aa02b446be8608dec39 Mon Sep 17 00:00:00 2001 From: Raul Santelices Date: Fri, 10 Nov 2023 13:26:16 -0500 Subject: [PATCH] Address re-keying case too --- src/main/java/net/schmizz/sshj/SSHClient.java | 2 +- src/main/java/net/schmizz/sshj/transport/TransportImpl.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/schmizz/sshj/SSHClient.java b/src/main/java/net/schmizz/sshj/SSHClient.java index 78b91c5f..dd0e3817 100644 --- a/src/main/java/net/schmizz/sshj/SSHClient.java +++ b/src/main/java/net/schmizz/sshj/SSHClient.java @@ -804,12 +804,12 @@ protected void onConnect() throws IOException { super.onConnect(); trans.init(getRemoteHostname(), getRemotePort(), getInputStream(), getOutputStream()); - doKex(); final KeepAlive keepAliveThread = conn.getKeepAlive(); if (keepAliveThread.isEnabled()) { ThreadNameProvider.setThreadName(conn.getKeepAlive(), trans); keepAliveThread.start(); } + doKex(); } /** diff --git a/src/main/java/net/schmizz/sshj/transport/TransportImpl.java b/src/main/java/net/schmizz/sshj/transport/TransportImpl.java index 58107c5b..69632fc1 100644 --- a/src/main/java/net/schmizz/sshj/transport/TransportImpl.java +++ b/src/main/java/net/schmizz/sshj/transport/TransportImpl.java @@ -420,9 +420,9 @@ public long write(SSHPacket payload) try { if (kexer.isKexOngoing()) { - // Only transport layer packets (1 to 49) allowed except SERVICE_REQUEST + // Only transport layer packets (1 to 49) allowed except SERVICE_REQUEST and IGNORE final Message m = Message.fromByte(payload.array()[payload.rpos()]); - if (!m.in(1, 49) || m == Message.SERVICE_REQUEST) { + if (!m.in(1, 49) || m == Message.SERVICE_REQUEST || m == Message.IGNORE) { assert m != Message.KEXINIT; kexer.waitForDone(); }