fusermount: drop privileges for chdir()
authorSam Huffman <40582525+samh-sifive@users.noreply.github.com>
Fri, 8 Mar 2019 21:26:31 +0000 (13:26 -0800)
committerNikolaus Rath <Nikolaus@rath.org>
Fri, 8 Mar 2019 21:26:31 +0000 (21:26 +0000)
cd to mountpoint's parent directory using unprivileged rather than
privileged access. This is to ensure that unmount works on mountpoints
where root may not have privileged access.

Fixes: #376
util/fusermount.c

index e6ac792ec02d86feec662be304a06f9e0cf57e94..3f13e4235ccd94a37440b9a94a717588ea4f427c 100644 (file)
@@ -428,7 +428,9 @@ static int unmount_fuse_locked(const char *mnt, int quiet, int lazy)
                return -1;
        }
 
+       drop_privs();
        res = chdir_to_parent(copy, &last);
+       restore_privs();
        if (res == -1)
                goto out;