From ab9b4479a1d7331c2a77444412eaf0b9ddc6b969 Mon Sep 17 00:00:00 2001 From: Adam Miller Date: Tue, 27 Mar 2018 19:26:00 -0500 Subject: [PATCH] Quote --rsh command options for rsync in syncrhonize module (#35976) Currently the --rsh command arg being passed to rsync is not quoted, but we're adding arguments to the ssh command and that causes rsync to attempt to accept them as it's own, which is not the desired outcome. Fixes #35717 Signed-off-by: Adam Miller --- lib/ansible/modules/files/synchronize.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/modules/files/synchronize.py b/lib/ansible/modules/files/synchronize.py index 35c755520b7..8a43f17b909 100644 --- a/lib/ansible/modules/files/synchronize.py +++ b/lib/ansible/modules/files/synchronize.py @@ -481,7 +481,7 @@ def main(): ssh_cmd_str = ' '.join(shlex_quote(arg) for arg in ssh_cmd) if ssh_args: ssh_cmd_str += ' %s' % ssh_args - cmd.append('--rsh=%s' % ssh_cmd_str) + cmd.append('--rsh=\'%s\'' % ssh_cmd_str) if rsync_path: cmd.append('--rsync-path=%s' % rsync_path)