forked from qt-creator/qt-creator
SSH: Fix misleading error message.
- It is not an error if the server replies to one of our earlier requests while we are in closing state. This can happen if we close the channel shortly after sending the other request. - Also change the message itself, which could be interpreted as "packet corrupt" when we actually meant "packet unexpected". Change-Id: I735c67b2a9b41af0c5e0b8d229369d94ec37277c Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
@@ -137,10 +137,16 @@ void AbstractSshChannel::flushSendBuffer()
|
|||||||
void AbstractSshChannel::handleOpenSuccess(quint32 remoteChannelId,
|
void AbstractSshChannel::handleOpenSuccess(quint32 remoteChannelId,
|
||||||
quint32 remoteWindowSize, quint32 remoteMaxPacketSize)
|
quint32 remoteWindowSize, quint32 remoteMaxPacketSize)
|
||||||
{
|
{
|
||||||
if (m_state != SessionRequested) {
|
switch (m_state) {
|
||||||
throw SSH_SERVER_EXCEPTION(SSH_DISCONNECT_PROTOCOL_ERROR,
|
case SessionRequested:
|
||||||
"Invalid SSH_MSG_CHANNEL_OPEN_CONFIRMATION packet.");
|
break; // Ok, continue.
|
||||||
}
|
case CloseRequested:
|
||||||
|
return; // Late server reply; we requested a channel close in the meantime.
|
||||||
|
default:
|
||||||
|
throw SSH_SERVER_EXCEPTION(SSH_DISCONNECT_PROTOCOL_ERROR,
|
||||||
|
"Unexpected SSH_MSG_CHANNEL_OPEN_CONFIRMATION packet.");
|
||||||
|
}
|
||||||
|
|
||||||
m_timeoutTimer->stop();
|
m_timeoutTimer->stop();
|
||||||
|
|
||||||
if (remoteMaxPacketSize < MinMaxPacketSize) {
|
if (remoteMaxPacketSize < MinMaxPacketSize) {
|
||||||
@@ -162,10 +168,16 @@ void AbstractSshChannel::handleOpenSuccess(quint32 remoteChannelId,
|
|||||||
|
|
||||||
void AbstractSshChannel::handleOpenFailure(const QString &reason)
|
void AbstractSshChannel::handleOpenFailure(const QString &reason)
|
||||||
{
|
{
|
||||||
if (m_state != SessionRequested) {
|
switch (m_state) {
|
||||||
throw SSH_SERVER_EXCEPTION(SSH_DISCONNECT_PROTOCOL_ERROR,
|
case SessionRequested:
|
||||||
"Invalid SSH_MSG_CHANNEL_OPEN_FAILURE packet.");
|
break; // Ok, continue.
|
||||||
}
|
case CloseRequested:
|
||||||
|
return; // Late server reply; we requested a channel close in the meantime.
|
||||||
|
default:
|
||||||
|
throw SSH_SERVER_EXCEPTION(SSH_DISCONNECT_PROTOCOL_ERROR,
|
||||||
|
"Unexpected SSH_MSG_CHANNEL_OPEN_CONFIRMATION packet.");
|
||||||
|
}
|
||||||
|
|
||||||
m_timeoutTimer->stop();
|
m_timeoutTimer->stop();
|
||||||
|
|
||||||
#ifdef CREATOR_SSH_DEBUG
|
#ifdef CREATOR_SSH_DEBUG
|
||||||
|
|||||||
Reference in New Issue
Block a user