Merge pull request #381 from moreati/ssh-7.5-permission-denied

Match "user@host: Permission denied ..." messages
This commit is contained in:
dw 2018-10-01 20:24:29 +01:00 committed by GitHub
commit c408395182
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -289,7 +289,11 @@ class Stream(mitogen.parent.Stream):
self._host_key_prompt() self._host_key_prompt()
elif HOSTKEY_FAIL in buf.lower(): elif HOSTKEY_FAIL in buf.lower():
raise HostKeyError(self.hostkey_failed_msg) raise HostKeyError(self.hostkey_failed_msg)
elif buf.lower().startswith(PERMDENIED_PROMPT): elif buf.lower().startswith((
PERMDENIED_PROMPT,
b("%s@%s: %s" % (self.username, self.hostname,
PERMDENIED_PROMPT)),
)):
# issue #271: work around conflict with user shell reporting # issue #271: work around conflict with user shell reporting
# 'permission denied' e.g. during chdir($HOME) by only matching # 'permission denied' e.g. during chdir($HOME) by only matching
# it at the start of the line. # it at the start of the line.