aboutsummaryrefslogtreecommitdiffstats
path: root/util/init_script
diff options
context:
space:
mode:
authorMatthias Goergens <matthias.goergens@gmail.com>2023-03-27 18:43:26 +0800
committerNikolaus Rath <Nikolaus@rath.org>2023-03-28 21:31:18 +0100
commit055478f11dd4f3d46653f89ffe63f7c5a400b114 (patch)
tree1aafb895d6870b701143b3cccbab33c813408e4f /util/init_script
parentb509964f7cc7260c16abb41bf4ccabdce08c6bce (diff)
downloadlibfuse-055478f11dd4f3d46653f89ffe63f7c5a400b114.tar.gz
Fix `auto_unmount` to work without `allow_other`
In https://github.com/libfuse/libfuse/blob/77d662459a0fcdf358d515477d33795837e859d5/util/fusermount.c#L1219 `open` is executed as root which does not have access to the mount point if `allow_other` was not used and the real user id is not 0. Since `allow_other` usually cannot be specified by unprivileged users, `auto_unmount` has no effect for unprivileged users. In this commit, we work around this limitation: We first try to open the mountpoint as root, and if we get `EACCES`, we retry as the user who started fusermount, and see if we get `ENOTCONN`. In my testing, I found that `setfsuid` and `setfsgid` don't work to get around the lack of `allow_other`. (Sorry, I don't know enough about the Linux kernel to tell whether that's significant.) As a workaround, I decided to use `setresuid` and `setresgid` in a forked child process, and communicate via its exit status. Please give feedback on correctness, style and suggest tests. Fixes https://github.com/libfuse/libfuse/issues/586
Diffstat (limited to 'util/init_script')
0 files changed, 0 insertions, 0 deletions