From 05e642ada5f4b0a62e523a659e8e5674818e4d1f Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 4 Aug 2016 16:44:18 -0400 Subject: [PATCH] Do not overwrite 'login' prompt in ssh plugin ssh plugin was sending backspaces without bound, causing deletion of the login prompt. --- confluent_server/confluent/plugins/shell/ssh.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/confluent_server/confluent/plugins/shell/ssh.py b/confluent_server/confluent/plugins/shell/ssh.py index 67ca12f2..1c6b6182 100644 --- a/confluent_server/confluent/plugins/shell/ssh.py +++ b/confluent_server/confluent/plugins/shell/ssh.py @@ -117,10 +117,12 @@ class SshShell(conapi.Console): def write(self, data): if self.inputmode == 0: - while len(data) > 0 and data[0] == b'\x7f': + while len(data) and data[0] == b'\x7f' and len(self.username): self.datacallback('\b \b') # erase previously echoed value self.username = self.username[:-1] data = data[1:] + while len(data) and data[0] == b'\x7f': + data = data[1:] while b'\x7f' in data: delidx = data.index(b'\x7f') data = data[:delidx - 1] + data[delidx + 1:]