mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-11-16 02:07:09 +00:00
Merge branch '1.0-channel-request-updates' into 2.0-channel-request-updates
This commit is contained in:
commit
2a09816088
@ -294,7 +294,7 @@ class Blowfish extends Base
|
|||||||
function setKeyLength($length)
|
function setKeyLength($length)
|
||||||
{
|
{
|
||||||
if ($length < 32) {
|
if ($length < 32) {
|
||||||
$this->key_length = 7;
|
$this->key_length = 4;
|
||||||
} elseif ($length > 448) {
|
} elseif ($length > 448) {
|
||||||
$this->key_length = 56;
|
$this->key_length = 56;
|
||||||
} else {
|
} else {
|
||||||
|
@ -296,7 +296,7 @@ class RC2 extends Base
|
|||||||
function setKeyLength($length)
|
function setKeyLength($length)
|
||||||
{
|
{
|
||||||
if ($length < 8) {
|
if ($length < 8) {
|
||||||
$this->default_key_length = 8;
|
$this->default_key_length = 1;
|
||||||
} elseif ($length > 1024) {
|
} elseif ($length > 1024) {
|
||||||
$this->default_key_length = 128;
|
$this->default_key_length = 128;
|
||||||
} else {
|
} else {
|
||||||
|
@ -3623,7 +3623,8 @@ class SSH2
|
|||||||
$this->window_size_server_to_client[$channel]+= $this->window_size;
|
$this->window_size_server_to_client[$channel]+= $this->window_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($type == NET_SSH2_MSG_CHANNEL_EXTENDED_DATA) {
|
switch ($type) {
|
||||||
|
case NET_SSH2_MSG_CHANNEL_EXTENDED_DATA:
|
||||||
/*
|
/*
|
||||||
if ($client_channel == NET_SSH2_CHANNEL_EXEC) {
|
if ($client_channel == NET_SSH2_CHANNEL_EXEC) {
|
||||||
$this->_send_channel_packet($client_channel, chr(0));
|
$this->_send_channel_packet($client_channel, chr(0));
|
||||||
@ -3637,7 +3638,7 @@ class SSH2
|
|||||||
$data = $this->_string_shift($response, $length);
|
$data = $this->_string_shift($response, $length);
|
||||||
$this->stdErrorLog.= $data;
|
$this->stdErrorLog.= $data;
|
||||||
if ($skip_extended || $this->quiet_mode) {
|
if ($skip_extended || $this->quiet_mode) {
|
||||||
continue;
|
continue 2;
|
||||||
}
|
}
|
||||||
if ($client_channel == $channel && $this->channel_status[$channel] == NET_SSH2_MSG_CHANNEL_DATA) {
|
if ($client_channel == $channel && $this->channel_status[$channel] == NET_SSH2_MSG_CHANNEL_DATA) {
|
||||||
return $data;
|
return $data;
|
||||||
@ -3647,7 +3648,55 @@ class SSH2
|
|||||||
}
|
}
|
||||||
$this->channel_buffers[$channel][] = $data;
|
$this->channel_buffers[$channel][] = $data;
|
||||||
|
|
||||||
continue;
|
continue 2;
|
||||||
|
case NET_SSH2_MSG_CHANNEL_REQUEST:
|
||||||
|
if ($this->channel_status[$channel] == NET_SSH2_MSG_CHANNEL_CLOSE) {
|
||||||
|
continue 2;
|
||||||
|
}
|
||||||
|
if (strlen($response) < 4) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
extract(unpack('Nlength', $this->_string_shift($response, 4)));
|
||||||
|
$value = $this->_string_shift($response, $length);
|
||||||
|
switch ($value) {
|
||||||
|
case 'exit-signal':
|
||||||
|
$this->_string_shift($response, 1);
|
||||||
|
if (strlen($response) < 4) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
extract(unpack('Nlength', $this->_string_shift($response, 4)));
|
||||||
|
$this->errors[] = 'SSH_MSG_CHANNEL_REQUEST (exit-signal): ' . $this->_string_shift($response, $length);
|
||||||
|
$this->_string_shift($response, 1);
|
||||||
|
if (strlen($response) < 4) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
extract(unpack('Nlength', $this->_string_shift($response, 4)));
|
||||||
|
if ($length) {
|
||||||
|
$this->errors[count($this->errors)].= "\r\n" . $this->_string_shift($response, $length);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->_send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_EOF, $this->server_channels[$client_channel]));
|
||||||
|
$this->_send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_CLOSE, $this->server_channels[$channel]));
|
||||||
|
|
||||||
|
$this->channel_status[$channel] = NET_SSH2_MSG_CHANNEL_EOF;
|
||||||
|
|
||||||
|
continue 3;
|
||||||
|
case 'exit-status':
|
||||||
|
if (strlen($response) < 5) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
extract(unpack('Cfalse/Nexit_status', $this->_string_shift($response, 5)));
|
||||||
|
$this->exit_status = $exit_status;
|
||||||
|
|
||||||
|
// "The client MAY ignore these messages."
|
||||||
|
// -- http://tools.ietf.org/html/rfc4254#section-6.10
|
||||||
|
|
||||||
|
continue 3;
|
||||||
|
default:
|
||||||
|
// "Some systems may not implement signals, in which case they SHOULD ignore this message."
|
||||||
|
// -- http://tools.ietf.org/html/rfc4254#section-6.9
|
||||||
|
continue 3;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($this->channel_status[$channel]) {
|
switch ($this->channel_status[$channel]) {
|
||||||
@ -3732,52 +3781,6 @@ class SSH2
|
|||||||
}
|
}
|
||||||
$this->channel_buffers[$channel][] = $data;
|
$this->channel_buffers[$channel][] = $data;
|
||||||
break;
|
break;
|
||||||
case NET_SSH2_MSG_CHANNEL_REQUEST:
|
|
||||||
if (strlen($response) < 4) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
extract(unpack('Nlength', $this->_string_shift($response, 4)));
|
|
||||||
$value = $this->_string_shift($response, $length);
|
|
||||||
switch ($value) {
|
|
||||||
case 'exit-signal':
|
|
||||||
$this->_string_shift($response, 1);
|
|
||||||
if (strlen($response) < 4) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
extract(unpack('Nlength', $this->_string_shift($response, 4)));
|
|
||||||
$this->errors[] = 'SSH_MSG_CHANNEL_REQUEST (exit-signal): ' . $this->_string_shift($response, $length);
|
|
||||||
$this->_string_shift($response, 1);
|
|
||||||
if (strlen($response) < 4) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
extract(unpack('Nlength', $this->_string_shift($response, 4)));
|
|
||||||
if ($length) {
|
|
||||||
$this->errors[count($this->errors)].= "\r\n" . $this->_string_shift($response, $length);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->_send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_EOF, $this->server_channels[$client_channel]));
|
|
||||||
$this->_send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_CLOSE, $this->server_channels[$channel]));
|
|
||||||
|
|
||||||
$this->channel_status[$channel] = NET_SSH2_MSG_CHANNEL_EOF;
|
|
||||||
|
|
||||||
break;
|
|
||||||
case 'exit-status':
|
|
||||||
if (strlen($response) < 5) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
extract(unpack('Cfalse/Nexit_status', $this->_string_shift($response, 5)));
|
|
||||||
$this->exit_status = $exit_status;
|
|
||||||
|
|
||||||
// "The client MAY ignore these messages."
|
|
||||||
// -- http://tools.ietf.org/html/rfc4254#section-6.10
|
|
||||||
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
// "Some systems may not implement signals, in which case they SHOULD ignore this message."
|
|
||||||
// -- http://tools.ietf.org/html/rfc4254#section-6.9
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case NET_SSH2_MSG_CHANNEL_CLOSE:
|
case NET_SSH2_MSG_CHANNEL_CLOSE:
|
||||||
$this->curTimeout = 0;
|
$this->curTimeout = 0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user