mirror of
https://github.com/danog/phpseclib.git
synced 2024-12-04 18:48:24 +01:00
Merge branch '2.0' into 3.0
This commit is contained in:
commit
dfb71b4fc7
@ -2778,7 +2778,7 @@ class SSH2
|
|||||||
NET_SSH2_MSG_CHANNEL_REQUEST,
|
NET_SSH2_MSG_CHANNEL_REQUEST,
|
||||||
$this->server_channels[self::CHANNEL_SHELL],
|
$this->server_channels[self::CHANNEL_SHELL],
|
||||||
'pty-req',
|
'pty-req',
|
||||||
1,
|
true, // want reply
|
||||||
$this->term,
|
$this->term,
|
||||||
$this->windowColumns,
|
$this->windowColumns,
|
||||||
$this->windowRows,
|
$this->windowRows,
|
||||||
@ -2789,24 +2789,6 @@ class SSH2
|
|||||||
|
|
||||||
$this->send_binary_packet($packet);
|
$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(
|
$packet = Strings::packSSH2(
|
||||||
'CNsb',
|
'CNsb',
|
||||||
NET_SSH2_MSG_CHANNEL_REQUEST,
|
NET_SSH2_MSG_CHANNEL_REQUEST,
|
||||||
@ -2816,7 +2798,7 @@ class SSH2
|
|||||||
);
|
);
|
||||||
$this->send_binary_packet($packet);
|
$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);
|
$response = $this->get_channel_packet(self::CHANNEL_SHELL);
|
||||||
if ($response === false) {
|
if ($response === false) {
|
||||||
@ -3830,6 +3812,16 @@ class SSH2
|
|||||||
throw new \RuntimeException('Unable to open channel');
|
throw new \RuntimeException('Unable to open channel');
|
||||||
}
|
}
|
||||||
break;
|
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:
|
case NET_SSH2_MSG_CHANNEL_REQUEST:
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case NET_SSH2_MSG_CHANNEL_SUCCESS:
|
case NET_SSH2_MSG_CHANNEL_SUCCESS:
|
||||||
@ -3849,6 +3841,10 @@ class SSH2
|
|||||||
|
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case NET_SSH2_MSG_CHANNEL_DATA:
|
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) {
|
if ($channel == self::CHANNEL_EXEC) {
|
||||||
// SCP requires null packets, such as this, be sent. further, in the case of the ssh.com SSH server
|
// SCP requires null packets, such as this, be sent. further, in the case of the ssh.com SSH server
|
||||||
|
Loading…
Reference in New Issue
Block a user