OSDN Git Service

SSH: Don't send keep-alive packet during key exchange.
authorChristian Kandeler <christian.kandeler@nokia.com>
Thu, 28 Apr 2011 09:12:34 +0000 (11:12 +0200)
committerChristian Kandeler <christian.kandeler@nokia.com>
Thu, 28 Apr 2011 09:22:08 +0000 (11:22 +0200)
Only certain types of messages are allowed in that phase.

src/libs/utils/ssh/sshconnection.cpp
src/libs/utils/ssh/sshpacket_p.h

index 9d90b8d..2ccc18b 100644 (file)
@@ -605,6 +605,12 @@ void SshConnectionPrivate::handleTimeout()
 
 void SshConnectionPrivate::sendKeepAlivePacket()
 {
+    // This type of message is not allowed during key exchange.
+    if (m_keyExchangeState != NoKeyExchange) {
+        m_keepAliveTimer.start();
+        return;
+    }
+
     Q_ASSERT(m_lastInvalidMsgSeqNr == InvalidSeqNr);
     m_lastInvalidMsgSeqNr = m_sendFacility.nextClientSeqNr();
     m_sendFacility.sendInvalidPacket();
index fab9243..8a107a6 100644 (file)
@@ -68,6 +68,8 @@ enum SshPacketType {
     SSH_MSG_REQUEST_SUCCESS = 81,
     SSH_MSG_REQUEST_FAILURE = 82,
 
+    // TODO: We currently take no precautions against sending these messages
+    //       during a key re-exchange, which is not allowed.
     SSH_MSG_CHANNEL_OPEN = 90,
     SSH_MSG_CHANNEL_OPEN_CONFIRMATION = 91,
     SSH_MSG_CHANNEL_OPEN_FAILURE = 92,