addresses low hanging fruit comments from terrafrost and bantu

This commit is contained in:
montdidier 2015-01-12 17:13:33 +08:00
parent aca4ba3286
commit dd0b3e6bd5
3 changed files with 4 additions and 7 deletions

View File

@ -101,8 +101,6 @@ define('NET_SSH2_CHANNEL_SHELL', 1);
define('NET_SSH2_CHANNEL_SUBSYSTEM', 2); define('NET_SSH2_CHANNEL_SUBSYSTEM', 2);
define('NET_SSH2_CHANNEL_AGENT_REQUEST', 3); define('NET_SSH2_CHANNEL_AGENT_REQUEST', 3);
define('NET_SSH2_CHANNEL_AGENT_FORWARD', 4); define('NET_SSH2_CHANNEL_AGENT_FORWARD', 4);
/**#@-*/ /**#@-*/
/**#@+ /**#@+
@ -2248,7 +2246,6 @@ class Net_SSH2
return false; return false;
} }
/** /**
* Set Timeout * Set Timeout
* *
@ -2825,8 +2822,6 @@ class Net_SSH2
} }
$payload = $this->_get_binary_packet(); $payload = $this->_get_binary_packet();
} }
default:
break;
} }
// see http://tools.ietf.org/html/rfc4252#section-5.4; only called when the encryption has been activated and when we haven't already logged in // see http://tools.ietf.org/html/rfc4252#section-5.4; only called when the encryption has been activated and when we haven't already logged in
@ -3007,7 +3002,7 @@ class Net_SSH2
} }
switch ($this->channel_status[$channel]) { switch ($this->channel_status[$channel]) {
case NET_SSH2_MSG_CHANNEL_OPEN:; case NET_SSH2_MSG_CHANNEL_OPEN:
switch ($type) { switch ($type) {
case NET_SSH2_MSG_CHANNEL_OPEN_CONFIRMATION: case NET_SSH2_MSG_CHANNEL_OPEN_CONFIRMATION:
extract(unpack('Nserver_channel', $this->_string_shift($response, 4))); extract(unpack('Nserver_channel', $this->_string_shift($response, 4)));

View File

@ -437,7 +437,7 @@ class System_SSH_Agent
function _forward_data($data) function _forward_data($data)
{ {
if ($this->expected_bytes > 0) { if ($this->expected_bytes > 0) {
$this->socket_buffer .= $data; $this->socket_buffer.= $data;
$this->expected_bytes -= strlen($data); $this->expected_bytes -= strlen($data);
} else { } else {
$agent_data_bytes = current(unpack('N', $data)); $agent_data_bytes = current(unpack('N', $data));

View File

@ -46,7 +46,9 @@ class Functional_Net_SSH2AgentTest extends PhpseclibFunctionalTestCase
$agent->startSSHForwarding($ssh); $agent->startSSHForwarding($ssh);
$this->assertEquals($username, trim($ssh->exec("ssh " . $username . "@" . $hostname . ' \'whoami\''))); $this->assertEquals($username, trim($ssh->exec("ssh " . $username . "@" . $hostname . ' \'whoami\'')));
$agent->stopSSHForwarding($ssh); $agent->stopSSHForwarding($ssh);
$this->assertEquals($username, 'failure');
return $args; return $args;
} }