Skip to content

Commit

Permalink
SSH2: behave like putty with broken publickey auth
Browse files Browse the repository at this point in the history
  • Loading branch information
terrafrost committed Jan 13, 2021
1 parent df94788 commit 7f1b53f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion phpseclib/Net/SSH2.php
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}

/**
Expand Down

1 comment on commit 7f1b53f

@terrafrost
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #1572

Please sign in to comment.