Conch ssh client auth order doesn't honour preferredOrder
|Reported by:||alanfranzoni||Owned by:|
branch-diff, diff-cov, branch-cov, buildbot
Problem lies in twisted.conch.ssh.userauth.py, class SSHUserAuthClient
when trying to auth, ordering doesn't work as expected; if preferredorder is ["a", "b"] and server return as auth methods , "a"?, the client will try to use, in order, ["x", "a"]. This happens because orderByPreference in ssh_USERAUTH_FAILURE() returns -1 when a method is NOT within preferredOrder, and util.dsu will then put this method to the beginning of the resulting canContinue list.
The test wasn't really suited to check for that error because the auth method "afirstmethod" did not exist on the client, and this just made the client skip that method because it couldn't fine auth_afirstmethod, and go on with the password.
The attached patch contains a modifed test which triggers the issue and a proposed fix.
Change History (13)
comment:5 Changed 7 years ago by
|Owner:||changed from jesstess to alanfranzoni|
comment:6 Changed 7 years ago by
|Owner:||changed from alanfranzoni to jesstess|