mirror of
https://github.com/ansible-collections/ansible.posix.git
synced 2026-05-07 05:43:04 +00:00
Synchronize: properly quote shell command components
The synchronize action plugin and module were a bit sloppy when it came to the command-line parameter quoting and that caused failuer on some systems (for example, on Fedora 34). This commit makes sure any argumnts with potentially problematic characters are quoted before being used.
This commit is contained in:
@@ -548,10 +548,10 @@ 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(shlex_quote('--rsh=%s' % ssh_cmd_str))
|
||||
cmd.append('--rsh=%s' % shlex_quote(ssh_cmd_str))
|
||||
|
||||
if rsync_path:
|
||||
cmd.append(shlex_quote('--rsync-path=%s' % rsync_path))
|
||||
cmd.append('--rsync-path=%s' % shlex_quote(rsync_path))
|
||||
|
||||
if rsync_opts:
|
||||
if '' in rsync_opts:
|
||||
@@ -577,7 +577,7 @@ def main():
|
||||
cmd.append('--link-dest=%s' % link_path)
|
||||
|
||||
changed_marker = '<<CHANGED>>'
|
||||
cmd.append(shlex_quote('--out-format=' + changed_marker + '%i %n%L'))
|
||||
cmd.append('--out-format=%s' % shlex_quote(changed_marker + '%i %n%L'))
|
||||
|
||||
# expand the paths
|
||||
if '@' not in source:
|
||||
|
||||
Reference in New Issue
Block a user