From 7f1b53fb672b1e9226abe67445b69b9947ace0e3 Mon Sep 17 00:00:00 2001 From: terrafrost Date: Tue, 12 Jan 2021 23:12:19 -0600 Subject: [PATCH] SSH2: behave like putty with broken publickey auth --- phpseclib/Net/SSH2.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/phpseclib/Net/SSH2.php b/phpseclib/Net/SSH2.php index 494abf7aa..3f9848451 100644 --- a/phpseclib/Net/SSH2.php +++ b/phpseclib/Net/SSH2.php @@ -2649,6 +2649,13 @@ function _privatekey_login($username, $privatekey) // we'll just take it on faith that the public key blob and the public key algorithm name are as // they should be $this->_updateLogHistory('UNKNOWN (60)', 'NET_SSH2_MSG_USERAUTH_PK_OK'); + break; + case NET_SSH2_MSG_USERAUTH_SUCCESS: + $this->bitmap |= NET_SSH2_MASK_LOGIN; + return true; + default: + user_error('Unexpected response to publickey authentication pt 1'); + return $this->_disconnect(NET_SSH2_DISCONNECT_BY_APPLICATION); } $packet = $part1 . chr(1) . $part2; @@ -2683,7 +2690,8 @@ function _privatekey_login($username, $privatekey) return true; } - return false; + user_error('Unexpected response to publickey authentication pt 2'); + return $this->_disconnect(NET_SSH2_DISCONNECT_BY_APPLICATION); } /**