mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-02-20 20:09:11 +00:00
TelnetConnection:
- Allowed telnet connections without a password. This is required as part of the upcoming Gem5Device, which uses a password-less telnet connection to communicate with the device.
This commit is contained in:
parent
661371f6f0
commit
a6382b730b
@ -62,15 +62,20 @@ class TelnetConnection(pxssh.pxssh):
|
||||
cmd = 'telnet -l {} {} {}'.format(username, server, port)
|
||||
|
||||
spawn._spawn(self, cmd) # pylint: disable=protected-access
|
||||
i = self.expect('(?i)(?:password)', timeout=login_timeout)
|
||||
if i == 0:
|
||||
self.sendline(password)
|
||||
i = self.expect([original_prompt, 'Login incorrect'], timeout=login_timeout)
|
||||
else:
|
||||
raise pxssh.ExceptionPxssh('could not log in: did not see a password prompt')
|
||||
|
||||
if i:
|
||||
raise pxssh.ExceptionPxssh('could not log in: password was incorrect')
|
||||
try:
|
||||
i = self.expect('(?i)(?:password)', timeout=login_timeout)
|
||||
if i == 0:
|
||||
self.sendline(password)
|
||||
i = self.expect([original_prompt, 'Login incorrect'], timeout=login_timeout)
|
||||
if i:
|
||||
raise pxssh.ExceptionPxssh('could not log in: password was incorrect')
|
||||
except TIMEOUT:
|
||||
if not password:
|
||||
# There was no password prompt before TIMEOUT, and we didn't
|
||||
# have a password to enter. Assume everything is OK.
|
||||
pass
|
||||
else:
|
||||
raise pxssh.ExceptionPxssh('could not log in: did not see a password prompt')
|
||||
|
||||
if not self.sync_original_prompt(sync_multiplier):
|
||||
self.close()
|
||||
|
Loading…
x
Reference in New Issue
Block a user