From b9112a9cbb10da3200d07dcc5acc16b2a01b4af9 Mon Sep 17 00:00:00 2001 From: Alex Willmer Date: Wed, 3 Oct 2018 00:06:53 +0100 Subject: [PATCH] ssh: Fix password authentication with Python 3.x & OpenSSH 7.5+ Since PERMDENIED_PROMPT is a byte string the interpolation was resulting in: b"user@host: b'permission denied'". Needless to say this didn't match. --- mitogen/ssh.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mitogen/ssh.py b/mitogen/ssh.py index f8255865..ee97425b 100644 --- a/mitogen/ssh.py +++ b/mitogen/ssh.py @@ -291,8 +291,8 @@ class Stream(mitogen.parent.Stream): raise HostKeyError(self.hostkey_failed_msg) elif buf.lower().startswith(( PERMDENIED_PROMPT, - b("%s@%s: %s" % (self.username, self.hostname, - PERMDENIED_PROMPT)), + b("%s@%s: " % (self.username, self.hostname)) + + PERMDENIED_PROMPT, )): # issue #271: work around conflict with user shell reporting # 'permission denied' e.g. during chdir($HOME) by only matching