fix some file modes in calls to withTmpFileIn to honor umask

Also audited for other calls to openTempFile, and all are ok,
except for viaTmp which will need further work.

Remote.Directory fixed to set umask mode when writing to an export,
although it has another one using viaTmp that's not fixed.
Will make exports that are published via a http server running as
another user work, for example.

Remote.BitTorrent fixed to set umask mode when downloading the torrent
file. Normally this does not matter as that file does not hang around
after the download, but if a bittorrent download were started by one user,
got interrupted and then another user ran it, this will let them access
the torrent file created by the first user.
This commit is contained in:
Joey Hess 2020-09-02 14:25:12 -04:00
parent 5a9f518a42
commit eed20fe3b7
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
5 changed files with 51 additions and 7 deletions

View file

@ -11,5 +11,11 @@ init, and some stuff in ~/.config/git-annex like autostart.
`withTmpFileIn` also uses openTempFile, and probably its callers do need to
adjust perms if desired since it could be used with a real temp directory.
> Audited and fixed these. It affected only directory special remote and
> bittorrent special remote if a download from it were interrupted and then
> resumed by a different user than the one who started it. --[[Joey]]
There are also a couple of other uses of openTempFile, which need to be
audited for this problem. --[[Joey]]
> Checked, all were ok. --[[Joey]]