mirror of
https://github.com/danog/phpseclib.git
synced 2024-11-27 04:46:26 +01: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;
|
||||
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;
|
||||
}
|
||||
} 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;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
$packet = pack('CN3a*Na*',
|
||||
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)
|
||||
{
|
||||
$request_channel = $ssh->_get_open_channel();
|
||||
if ($request_channel === false) {
|
||||
user_error("failed to request channel");
|
||||
return false;
|
||||
}
|
||||
|
||||
$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);
|
||||
|
Loading…
Reference in New Issue
Block a user