SSH2: missed a few user_error's

This commit is contained in:
terrafrost 2015-08-31 23:34:33 -05:00
parent a6fd9ea8b6
commit 724ba7ccc9

View File

@ -1431,13 +1431,11 @@ class SSH2
$response = $this->_get_binary_packet(); $response = $this->_get_binary_packet();
if ($response === false) { if ($response === false) {
user_error('Connection closed by server'); throw new \RuntimeException('Connection closed by server');
return false;
} }
extract(unpack('Ctype', $this->_string_shift($response, 1))); extract(unpack('Ctype', $this->_string_shift($response, 1)));
if ($type != NET_SSH2_MSG_KEXDH_GEX_GROUP) { if ($type != NET_SSH2_MSG_KEXDH_GEX_GROUP) {
user_error('Expected SSH_MSG_KEX_DH_GEX_GROUP'); throw new \UnexpectedValueException('Expected SSH_MSG_KEX_DH_GEX_GROUP');
return false;
} }
extract(unpack('NprimeLength', $this->_string_shift($response, 4))); extract(unpack('NprimeLength', $this->_string_shift($response, 4)));
@ -1963,8 +1961,7 @@ class SSH2
$response = $this->_get_binary_packet(); $response = $this->_get_binary_packet();
if ($response === false) { if ($response === false) {
user_error('Connection closed by server'); throw new \RuntimeException('Connection closed by server');
return false;
} }
extract(unpack('Ctype', $this->_string_shift($response, 1))); extract(unpack('Ctype', $this->_string_shift($response, 1)));
@ -2569,8 +2566,7 @@ class SSH2
$this->is_timeout = false; $this->is_timeout = false;
if (!($this->bitmap & self::MASK_LOGIN)) { if (!($this->bitmap & self::MASK_LOGIN)) {
user_error('Operation disallowed prior to login()'); throw new \RuntimeException('Operation disallowed prior to login()');
return false;
} }
if (!($this->bitmap & self::MASK_SHELL) && !$this->_initShell()) { if (!($this->bitmap & self::MASK_SHELL) && !$this->_initShell()) {
@ -2778,8 +2774,7 @@ class SSH2
$raw = $this->decrypt->decrypt($raw); $raw = $this->decrypt->decrypt($raw);
} }
if ($raw === false) { if ($raw === false) {
user_error('Unable to decrypt content'); throw new \RuntimeException('Unable to decrypt content');
return false;
} }
extract(unpack('Npacket_length/Cpadding_length', $this->_string_shift($raw, 5))); extract(unpack('Npacket_length/Cpadding_length', $this->_string_shift($raw, 5)));
@ -3065,7 +3060,6 @@ class SSH2
$response = $this->_get_binary_packet(); $response = $this->_get_binary_packet();
if ($response === false) { if ($response === false) {
throw new \RuntimeException('Connection closed by server'); throw new \RuntimeException('Connection closed by server');
return false;
} }
if ($client_channel == -1 && $response === true) { if ($client_channel == -1 && $response === true) {
return true; return true;
@ -3255,9 +3249,8 @@ class SSH2
function _send_binary_packet($data, $logged = null) function _send_binary_packet($data, $logged = null)
{ {
if (!is_resource($this->fsock) || feof($this->fsock)) { if (!is_resource($this->fsock) || feof($this->fsock)) {
user_error('Connection closed prematurely');
$this->bitmap = 0; $this->bitmap = 0;
return false; throw new \RuntimeException('Connection closed prematurely');
} }
//if ($this->compress) { //if ($this->compress) {