1
0
mirror of https://github.com/danog/phpseclib.git synced 2024-12-03 18:18:05 +01:00

Merge branch '2.0' into 3.0

This commit is contained in:
terrafrost 2021-03-27 10:33:46 -05:00
commit dfb71b4fc7

View File

@ -2778,7 +2778,7 @@ class SSH2
NET_SSH2_MSG_CHANNEL_REQUEST,
$this->server_channels[self::CHANNEL_SHELL],
'pty-req',
1,
true, // want reply
$this->term,
$this->windowColumns,
$this->windowRows,
@ -2789,24 +2789,6 @@ class SSH2
$this->send_binary_packet($packet);
$response = $this->get_binary_packet();
if ($response === false) {
$this->disconnect_helper(NET_SSH2_DISCONNECT_CONNECTION_LOST);
throw new ConnectionClosedException('Connection closed by server');
}
list($type) = Strings::unpackSSH2('C', $response);
switch ($type) {
case NET_SSH2_MSG_CHANNEL_SUCCESS:
// if a pty can't be opened maybe commands can still be executed
case NET_SSH2_MSG_CHANNEL_FAILURE:
break;
default:
$this->disconnect_helper(NET_SSH2_DISCONNECT_BY_APPLICATION);
throw new \UnexpectedValueException('Unable to request pseudo-terminal');
}
$packet = Strings::packSSH2(
'CNsb',
NET_SSH2_MSG_CHANNEL_REQUEST,
@ -2816,7 +2798,7 @@ class SSH2
);
$this->send_binary_packet($packet);
$this->channel_status[self::CHANNEL_SHELL] = NET_SSH2_MSG_CHANNEL_REQUEST;
$this->channel_status[self::CHANNEL_SHELL] = NET_SSH2_MSG_IGNORE;
$response = $this->get_channel_packet(self::CHANNEL_SHELL);
if ($response === false) {
@ -3830,6 +3812,16 @@ class SSH2
throw new \RuntimeException('Unable to open channel');
}
break;
case NET_SSH2_MSG_IGNORE:
switch ($type) {
case NET_SSH2_MSG_CHANNEL_SUCCESS:
//$this->channel_status[$channel] = NET_SSH2_MSG_CHANNEL_DATA;
continue 3;
case NET_SSH2_MSG_CHANNEL_FAILURE:
$this->_disconnect(NET_SSH2_DISCONNECT_BY_APPLICATION);
throw new \RuntimeException('Error opening channel');
}
break;
case NET_SSH2_MSG_CHANNEL_REQUEST:
switch ($type) {
case NET_SSH2_MSG_CHANNEL_SUCCESS:
@ -3849,6 +3841,10 @@ class SSH2
switch ($type) {
case NET_SSH2_MSG_CHANNEL_DATA:
//if ($this->channel_status[$channel] == NET_SSH2_MSG_IGNORE) {
// $this->channel_status[$channel] = NET_SSH2_MSG_CHANNEL_DATA;
//}
/*
if ($channel == self::CHANNEL_EXEC) {
// SCP requires null packets, such as this, be sent. further, in the case of the ssh.com SSH server