Blob Blame History Raw
From e6e8335847d4870c99c07f511b4a24ae9e053326 Mon Sep 17 00:00:00 2001
From: Jakub Jelen <jjelen@redhat.com>
Date: Thu, 15 Nov 2018 11:03:56 +0100
Subject: [PATCH] packet: Adjust the packet filter to allow client-initialized
 rekey

If the rekey is initialized by client, it sends the first KEXINIT
message, changes to the INIT_SENT state and waits for the KEXINIT
message from the server. This was not covered in the current filter.

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Daiki Ueno <dueno@redhat.com>
---
 src/packet.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/packet.c b/src/packet.c
index 9b7b9b8f..86314961 100644
--- a/src/packet.c
+++ b/src/packet.c
@@ -292,6 +292,7 @@ static enum ssh_packet_filter_result_e ssh_packet_incoming_filter(ssh_session se
          * - session_state == SSH_SESSION_STATE_AUTHENTICATED
          *   or session_state == SSH_SESSION_STATE_INITIAL_KEX
          * - dh_handshake_state == DH_STATE_INIT
+         *   or dh_handshake_state == DH_STATE_INIT_SENT (re-exchange)
          *   or dh_handshake_state == DH_STATE_FINISHED (re-exchange)
          *
          * Transitions:
@@ -310,6 +311,7 @@ static enum ssh_packet_filter_result_e ssh_packet_incoming_filter(ssh_session se
         }
 
         if ((session->dh_handshake_state != DH_STATE_INIT) &&
+            (session->dh_handshake_state != DH_STATE_INIT_SENT) &&
             (session->dh_handshake_state != DH_STATE_FINISHED))
         {
             rc = SSH_PACKET_DENIED;
-- 
2.19.1