diff --git a/twisted/conch/ssh/userauth.py b/twisted/conch/ssh/userauth.py
|
a
|
b
|
|
| 830 | 830 | MSG_USERAUTH_FAILURE = 51 |
| 831 | 831 | MSG_USERAUTH_SUCCESS = 52 |
| 832 | 832 | MSG_USERAUTH_BANNER = 53 |
| 833 | | MSG_USERAUTH_PASSWD_CHANGEREQ = 60 |
| 834 | | MSG_USERAUTH_INFO_REQUEST = 60 |
| 835 | 833 | MSG_USERAUTH_INFO_RESPONSE = 61 |
| 836 | 834 | MSG_USERAUTH_PK_OK = 60 |
| 837 | 835 | |
| 838 | 836 | messages = {} |
| 839 | 837 | for k, v in locals().items(): |
| 840 | 838 | if k[:4]=='MSG_': |
| 841 | | messages[v] = k # doesn't handle doubles |
| | 839 | messages[v] = k |
| 842 | 840 | |
| 843 | 841 | SSHUserAuthServer.protocolMessages = messages |
| 844 | 842 | SSHUserAuthClient.protocolMessages = messages |
| 845 | 843 | del messages |
| 846 | 844 | del v |
| | 845 | |
| | 846 | # Doubles, not included in the protocols' mappings |
| | 847 | MSG_USERAUTH_PASSWD_CHANGEREQ = 60 |
| | 848 | MSG_USERAUTH_INFO_REQUEST = 60 |
diff --git a/twisted/conch/test/test_userauth.py b/twisted/conch/test/test_userauth.py
|
a
|
b
|
|
| 1060 | 1060 | def check(ignored): |
| 1061 | 1061 | self.assertEqual(server.transport.service.name, 'TestService') |
| 1062 | 1062 | return d.addCallback(check) |
| | 1063 | |
| | 1064 | |
| | 1065 | |
| | 1066 | class ModuleInitializationTestCase(unittest.TestCase): |
| | 1067 | |
| | 1068 | |
| | 1069 | def test_messages(self): |
| | 1070 | # Several message types have value 60, check that MSG_USERAUTH_PK_OK |
| | 1071 | # is always the one which is mapped. |
| | 1072 | self.assertEqual(userauth.SSHUserAuthServer.protocolMessages[60], |
| | 1073 | 'MSG_USERAUTH_PK_OK') |
| | 1074 | self.assertEqual(userauth.SSHUserAuthClient.protocolMessages[60], |
| | 1075 | 'MSG_USERAUTH_PK_OK') |
diff --git a/twisted/conch/topfiles/5776.bugfix b/twisted/conch/topfiles/5776.bugfix
new file mode 100644
|
a
|
b
|
|
| | 1 | twisted.conch.ssh.userauth now works correctly with hash randomization enabled. |