diff options
Diffstat (limited to 'paramiko/transport.py')
-rw-r--r-- | paramiko/transport.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/paramiko/transport.py b/paramiko/transport.py index 22992e17..44361b0c 100644 --- a/paramiko/transport.py +++ b/paramiko/transport.py @@ -110,6 +110,7 @@ from paramiko.ssh_exception import ( BadAuthenticationType, ChannelException, IncompatiblePeer, + MessageOrderError, ProxyCommandFailure, SSHException, ) @@ -2148,7 +2149,10 @@ class Transport(threading.Thread, ClosingContextManager): continue if len(self._expected_packet) > 0: if ptype not in self._expected_packet: - raise SSHException( + exc_class = SSHException + if self.agreed_on_strict_kex: + exc_class = MessageOrderError + raise exc_class( "Expecting packet from {!r}, got {:d}".format( self._expected_packet, ptype ) |