This commit is contained in:
terrafrost 2016-12-17 17:22:11 -06:00
commit 2a7c99ef1b

View File

@ -2512,7 +2512,7 @@ class SSH2
$this->is_timeout = false; $this->is_timeout = false;
$this->stdErrorLog = ''; $this->stdErrorLog = '';
if (!($this->bitmap & self::MASK_LOGIN)) { if (!$this->isAuthenticated()) {
return false; return false;
} }
@ -2811,7 +2811,7 @@ class SSH2
$this->curTimeout = $this->timeout; $this->curTimeout = $this->timeout;
$this->is_timeout = false; $this->is_timeout = false;
if (!($this->bitmap & self::MASK_LOGIN)) { if (!$this->isAuthenticated()) {
throw new \RuntimeException('Operation disallowed prior to login()'); throw new \RuntimeException('Operation disallowed prior to login()');
} }
@ -2852,7 +2852,7 @@ class SSH2
*/ */
function write($cmd) function write($cmd)
{ {
if (!($this->bitmap & self::MASK_LOGIN)) { if (!$this->isAuthenticated()) {
throw new \RuntimeException('Operation disallowed prior to login()'); throw new \RuntimeException('Operation disallowed prior to login()');
} }
@ -3153,7 +3153,7 @@ class SSH2
} }
// 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
if (($this->bitmap & self::MASK_CONNECTED) && !($this->bitmap & self::MASK_LOGIN) && ord($payload[0]) == NET_SSH2_MSG_USERAUTH_BANNER) { if (($this->bitmap & self::MASK_CONNECTED) && !$this->isAuthenticated() && ord($payload[0]) == NET_SSH2_MSG_USERAUTH_BANNER) {
Strings::shift($payload, 1); Strings::shift($payload, 1);
if (strlen($payload) < 4) { if (strlen($payload) < 4) {
return false; return false;
@ -3164,7 +3164,7 @@ class SSH2
} }
// only called when we've already logged in // only called when we've already logged in
if (($this->bitmap & self::MASK_CONNECTED) && ($this->bitmap & self::MASK_LOGIN)) { if (($this->bitmap & self::MASK_CONNECTED) && $this->isAuthenticated()) {
switch (ord($payload[0])) { switch (ord($payload[0])) {
case NET_SSH2_MSG_GLOBAL_REQUEST: // see http://tools.ietf.org/html/rfc4254#section-4 case NET_SSH2_MSG_GLOBAL_REQUEST: // see http://tools.ietf.org/html/rfc4254#section-4
if (strlen($payload) < 4) { if (strlen($payload) < 4) {