From f30fb0b3fd5032c083bd646cfc3697bd930e8df9 Mon Sep 17 00:00:00 2001 From: Douglas Raillard Date: Mon, 26 Jun 2023 15:28:43 +0100 Subject: [PATCH] utils/ssh: Ensure the detected sshpass is used Since we detect the sshpass tool using which(), ensure that the code uses that instead of just relying on PATH. --- devlib/utils/ssh.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/devlib/utils/ssh.py b/devlib/utils/ssh.py index f07b67b..58b7659 100644 --- a/devlib/utils/ssh.py +++ b/devlib/utils/ssh.py @@ -1604,13 +1604,15 @@ class AndroidGem5Connection(Gem5Connection): gem5_logger.info("Android booted") + def _give_password(password, command): - if not sshpass: + if sshpass: + pass_template = "{} -p {} " + pass_string = pass_template.format(quote(sshpass), quote(password)) + redacted_string = pass_template.format(quote(sshpass), quote('')) + return (pass_string + command, redacted_string + command) + else: raise HostError('Must have sshpass installed on the host in order to use password-based auth.') - pass_template = "sshpass -p {} " - pass_string = pass_template.format(quote(password)) - redacted_string = pass_template.format(quote('')) - return (pass_string + command, redacted_string + command) def process_backspaces(text):