mirror of
https://github.com/danog/phpseclib.git
synced 2024-12-11 16:49:42 +01:00
SSH2: fixes for noisy channels
This commit is contained in:
parent
b29f134c24
commit
1fab947f01
@ -2829,26 +2829,12 @@ class Net_SSH2
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$response = $this->_get_binary_packet();
|
$this->channel_status[NET_SSH2_CHANNEL_EXEC] = NET_SSH2_MSG_CHANNEL_REQUEST;
|
||||||
if ($response === false) {
|
if (!$this->_get_channel_packet(NET_SSH2_CHANNEL_EXEC)) {
|
||||||
$this->bitmap = 0;
|
user_error('Unable to request pseudo-terminal');
|
||||||
user_error('Connection closed by server');
|
return $this->_disconnect(NET_SSH2_DISCONNECT_BY_APPLICATION);
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strlen($response)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
list(, $type) = unpack('C', $this->_string_shift($response, 1));
|
|
||||||
|
|
||||||
switch ($type) {
|
|
||||||
case NET_SSH2_MSG_CHANNEL_SUCCESS:
|
|
||||||
break;
|
|
||||||
case NET_SSH2_MSG_CHANNEL_FAILURE:
|
|
||||||
default:
|
|
||||||
user_error('Unable to request pseudo-terminal');
|
|
||||||
return $this->_disconnect(NET_SSH2_DISCONNECT_BY_APPLICATION);
|
|
||||||
}
|
|
||||||
$this->in_request_pty_exec = true;
|
$this->in_request_pty_exec = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3911,10 +3897,15 @@ class Net_SSH2
|
|||||||
$result = $client_channel == $channel ? true : $this->_get_channel_packet($client_channel, $skip_extended);
|
$result = $client_channel == $channel ? true : $this->_get_channel_packet($client_channel, $skip_extended);
|
||||||
$this->_on_channel_open();
|
$this->_on_channel_open();
|
||||||
return $result;
|
return $result;
|
||||||
//case NET_SSH2_MSG_CHANNEL_OPEN_FAILURE:
|
case NET_SSH2_MSG_CHANNEL_OPEN_FAILURE:
|
||||||
default:
|
|
||||||
user_error('Unable to open channel');
|
user_error('Unable to open channel');
|
||||||
return $this->_disconnect(NET_SSH2_DISCONNECT_BY_APPLICATION);
|
return $this->_disconnect(NET_SSH2_DISCONNECT_BY_APPLICATION);
|
||||||
|
default:
|
||||||
|
if ($client_channel == $channel) {
|
||||||
|
user_error('Unexpected response to open request');
|
||||||
|
return $this->_disconnect(NET_SSH2_DISCONNECT_BY_APPLICATION);
|
||||||
|
}
|
||||||
|
return $this->_get_channel_packet($client_channel, $skip_extended);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case NET_SSH2_MSG_IGNORE:
|
case NET_SSH2_MSG_IGNORE:
|
||||||
|
Loading…
Reference in New Issue
Block a user