mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-11-11 16:15:52 +00:00
exec authentication, code reuse
This commit is contained in:
parent
d0cb855bbc
commit
d80794b1d9
@ -2597,7 +2597,7 @@ class Net_SSH2
|
||||
$this->is_timeout = false;
|
||||
$this->stdErrorLog = '';
|
||||
|
||||
if (!($this->bitmap & NET_SSH2_MASK_LOGIN)) {
|
||||
if (!$this->isAuthenticated()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -2896,7 +2896,7 @@ class Net_SSH2
|
||||
$this->curTimeout = $this->timeout;
|
||||
$this->is_timeout = false;
|
||||
|
||||
if (!($this->bitmap & NET_SSH2_MASK_LOGIN)) {
|
||||
if (!$this->isAuthenticated()) {
|
||||
user_error('Operation disallowed prior to login()');
|
||||
return false;
|
||||
}
|
||||
@ -2938,7 +2938,7 @@ class Net_SSH2
|
||||
*/
|
||||
function write($cmd)
|
||||
{
|
||||
if (!($this->bitmap & NET_SSH2_MASK_LOGIN)) {
|
||||
if (!$this->isAuthenticated()) {
|
||||
user_error('Operation disallowed prior to login()');
|
||||
return false;
|
||||
}
|
||||
@ -3248,7 +3248,7 @@ class Net_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
|
||||
if (($this->bitmap & NET_SSH2_MASK_CONNECTED) && !($this->bitmap & NET_SSH2_MASK_LOGIN) && ord($payload[0]) == NET_SSH2_MSG_USERAUTH_BANNER) {
|
||||
if (($this->bitmap & NET_SSH2_MASK_CONNECTED) && !$this->isAuthenticated() && ord($payload[0]) == NET_SSH2_MSG_USERAUTH_BANNER) {
|
||||
$this->_string_shift($payload, 1);
|
||||
if (strlen($payload) < 4) {
|
||||
return false;
|
||||
@ -3259,7 +3259,7 @@ class Net_SSH2
|
||||
}
|
||||
|
||||
// only called when we've already logged in
|
||||
if (($this->bitmap & NET_SSH2_MASK_CONNECTED) && ($this->bitmap & NET_SSH2_MASK_LOGIN)) {
|
||||
if (($this->bitmap & NET_SSH2_MASK_CONNECTED) && $this->isAuthenticated()) {
|
||||
switch (ord($payload[0])) {
|
||||
case NET_SSH2_MSG_GLOBAL_REQUEST: // see http://tools.ietf.org/html/rfc4254#section-4
|
||||
if (strlen($payload) < 4) {
|
||||
|
Loading…
Reference in New Issue
Block a user