mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-12-25 19:21:09 +00:00
preference isset over array_key_exists, return false on failure, break after return channel opened
This commit is contained in:
parent
1803bcac0b
commit
9723acc885
@ -2499,12 +2499,12 @@ class Net_SSH2
|
|||||||
{
|
{
|
||||||
$channel = NET_SSH2_CHANNEL_EXEC;
|
$channel = NET_SSH2_CHANNEL_EXEC;
|
||||||
do {
|
do {
|
||||||
if (array_key_exists($channel, $this->channel_status) && $this->channel_status[$channel] == NET_SSH2_MSG_CHANNEL_OPEN) {
|
if (isset($this->channel_status[$channel]) && $this->channel_status[$channel] == NET_SSH2_MSG_CHANNEL_OPEN) {
|
||||||
return $channel;
|
return $channel;
|
||||||
}
|
}
|
||||||
} while ($channel++ < NET_SSH2_CHANNEL_SUBSYSTEM);
|
} while ($channel++ < NET_SSH2_CHANNEL_SUBSYSTEM);
|
||||||
|
|
||||||
user_error("Unable to find an open channel");
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2891,6 +2891,7 @@ class Net_SSH2
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
$packet = pack('CN3a*Na*',
|
$packet = pack('CN3a*Na*',
|
||||||
NET_SSH2_MSG_REQUEST_FAILURE, $server_channel, NET_SSH2_OPEN_ADMINISTRATIVELY_PROHIBITED, 0, '', 0, '');
|
NET_SSH2_MSG_REQUEST_FAILURE, $server_channel, NET_SSH2_OPEN_ADMINISTRATIVELY_PROHIBITED, 0, '', 0, '');
|
||||||
|
@ -374,6 +374,10 @@ class System_SSH_Agent
|
|||||||
function _request_forwarding($ssh)
|
function _request_forwarding($ssh)
|
||||||
{
|
{
|
||||||
$request_channel = $ssh->_get_open_channel();
|
$request_channel = $ssh->_get_open_channel();
|
||||||
|
if ($request_channel === false) {
|
||||||
|
user_error("failed to request channel");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$packet = pack('CNNa*C',
|
$packet = pack('CNNa*C',
|
||||||
NET_SSH2_MSG_CHANNEL_REQUEST, $ssh->server_channels[$request_channel], strlen('auth-agent-req@openssh.com'), 'auth-agent-req@openssh.com', 1);
|
NET_SSH2_MSG_CHANNEL_REQUEST, $ssh->server_channels[$request_channel], strlen('auth-agent-req@openssh.com'), 'auth-agent-req@openssh.com', 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user