Samanta Navarro cde221b858 copy_tree: carefully treat permissions
The setuid, setgid, and sticky bits are not copied during copy_tree.

Also start with very restrictive permissions before setting ownerships.

This prevents situations in which users in a group with less permissions
than others could win a race in opening the file before permissions are
removed again.

Proof of concept:

$ echo $HOME
/home/uwu
$ install -o uwu -g fandom -m 604 /dev/null /home/uwu/owo
$ ls -l /home/uwu/owo
-rw----r-- 1 uwu fandom 0 Sep  4 00:00 /home/uwu/owo

If /tmp is on another filesystem, then "usermod -md /tmp/uwu uwu" leads
to this temporary situation:

$ ls -l /tmp/uwu/owo
-rw----r-- 1 root root  0 Sep  4 00:00 /tmp/uwu/owo

This means that between openat and chownat_if_needed a user of group
fandom could open /tmp/uwu/owo and read the content when it is finally
written into the file.
2022-09-14 10:11:32 +02:00
..
2021-12-23 19:36:50 -06:00
2021-12-23 19:36:50 -06:00
2022-08-06 11:27:56 -05:00
2022-09-02 20:27:14 -05:00
2021-12-23 19:36:50 -06:00
2022-08-17 12:34:01 -05:00
2021-12-23 19:36:50 -06:00
2022-08-06 11:27:56 -05:00
2021-12-23 19:36:50 -06:00
2022-08-06 11:27:56 -05:00
2021-12-23 19:36:50 -06:00
2021-12-23 19:36:50 -06:00
2021-12-23 19:36:50 -06:00
2022-08-06 11:27:56 -05:00
2021-12-23 19:36:50 -06:00
2022-08-06 11:27:56 -05:00
2022-08-06 11:27:56 -05:00
2021-12-23 19:36:50 -06:00
2021-12-23 19:36:50 -06:00
2021-12-23 19:36:50 -06:00
2021-12-23 19:36:50 -06:00
2022-08-06 11:27:56 -05:00
2021-12-23 19:36:50 -06:00
2021-12-23 19:36:50 -06:00
2022-01-03 15:09:17 +01:00
2021-12-23 19:36:50 -06:00
2021-12-23 19:36:50 -06:00
2022-08-17 12:34:01 -05:00
2021-12-23 19:36:50 -06:00
2022-08-06 11:27:56 -05:00
2021-12-23 19:36:50 -06:00
2022-08-06 11:27:56 -05:00
2021-12-23 19:36:50 -06:00
2021-12-23 19:36:50 -06:00
2021-12-23 19:36:50 -06:00
2021-12-23 19:36:50 -06:00
2021-12-23 19:36:50 -06:00
2021-12-23 19:36:50 -06:00
2021-12-23 19:36:50 -06:00
2021-12-23 19:36:50 -06:00
2021-12-23 19:36:50 -06:00
2021-12-23 19:36:50 -06:00
2021-12-23 19:36:50 -06:00
2021-12-23 19:36:50 -06:00
2022-03-18 20:24:10 -05:00
2022-08-06 11:27:56 -05:00
2021-12-23 19:36:50 -06:00