diff options
author | Ben Hutchings <ben.hutchings@codethink.co.uk> | 2020-05-13 17:56:36 +0100 |
---|---|---|
committer | Ben Hutchings <ben.hutchings@codethink.co.uk> | 2020-06-01 16:59:06 +0100 |
commit | c9d8b4c132667c9eba92ac696047892e6f65e4cf (patch) | |
tree | 938cd5b39c89e48eea198f34466bb6809712ae08 /lorrycontroller | |
parent | 8976b895d5c026c4976a6ddeabe8487f80940dd4 (diff) | |
download | lorry-controller-c9d8b4c132667c9eba92ac696047892e6f65e4cf.tar.gz |
gerrit: Shell-quote ssh command arguments
The Secure Shell protocol does not allow passing an argument vector,
only a command line that will be interpreted by a specific program
(usually a shell, but in this case Gerrit) on the remote host.
OpenSSH's ssh command simply concatenates the remote command arguments
with spaces between them, so we need to shell-quote them first.
Closes #8.
Diffstat (limited to 'lorrycontroller')
-rw-r--r-- | lorrycontroller/gerrit.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lorrycontroller/gerrit.py b/lorrycontroller/gerrit.py index 6ae24e3..4e77ba7 100644 --- a/lorrycontroller/gerrit.py +++ b/lorrycontroller/gerrit.py @@ -34,7 +34,8 @@ class Gerrit(object): '%s@%s' % (user, host)] def _ssh_command(self, command): - out = cliapp.runcmd(self._ssh_command_args + command) + quoted_args = [cliapp.shell_quote(x) for x in command] + out = cliapp.runcmd(self._ssh_command_args + quoted_args) if isinstance(out, bytes): out = out.decode('utf-8', errors='replace') return out |