mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 06:12:51 +00:00
Fix copy module to reset filesystem acls (#51868)
The controller's fixup_perms2 uses filesystem acls to make the temporary file for copy readable by an unprivileged become user. On Python3, the acls are then copied to the destination filename so we have to remove them from there. We can't remove them prior to the copy because we may not have permission to read the file if the acls are not present. We can't remove them in atomic_move() because the move function shouldn't know anything about controller features. We may want to generalize this into a helper function, though. Fixes #44412 Co-authored-by: Toshio Kuratomi <a.badger@gmail.com>
This commit is contained in:
@@ -305,6 +305,10 @@ class ActionModule(ActionBase):
|
||||
self._remove_tempfile_if_content_defined(content, content_tempfile)
|
||||
self._loader.cleanup_tmp_file(source_full)
|
||||
|
||||
# FIXME: I don't think this is needed when PIPELINING=0 because the source is created
|
||||
# world readable. Access to the directory itself is controlled via fixup_perms2() as
|
||||
# part of executing the module. Check that umask with scp/sftp/piped doesn't cause
|
||||
# a problem before acting on this idea. (This idea would save a round-trip)
|
||||
# fix file permissions when the copy is done as a different user
|
||||
if remote_path:
|
||||
self._fixup_perms2((self._connection._shell.tmpdir, remote_path))
|
||||
|
||||
Reference in New Issue
Block a user