From dfdf8603e231b73e502e080176dd763d4ecb43d2 Mon Sep 17 00:00:00 2001 From: netblue30 Date: Thu, 21 Jan 2016 12:03:16 -0500 Subject: fix gvfs bug --- src/firejail/fs.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/firejail/fs.c b/src/firejail/fs.c index cef1cc68b..50e55f868 100644 --- a/src/firejail/fs.c +++ b/src/firejail/fs.c @@ -181,11 +181,40 @@ static void disable_file(OPERATION op, const char *filename) { // Resolve all symlinks char* fname = realpath(filename, NULL); - if (fname == NULL) { + if (fname == NULL && errno != EACCES) { if (arg_debug) printf("Warning: %s is an invalid file, skipping...\n", filename); return; } + if (fname == NULL && errno == EACCES) { + if (arg_debug) + printf("Debug: no access to file %s, forcing mount\n", filename); + // realpath and stat funtions will fail on FUSE filesystems + // they don't seem to like a uid of 0 + // force mounting + int rv = mount(RUN_RO_DIR, filename, "none", MS_BIND, "mode=400,gid=0"); + if (rv == 0) + last_disable = SUCCESSFUL; + else { + rv = mount(RUN_RO_FILE, filename, "none", MS_BIND, "mode=400,gid=0"); + if (rv == 0) + last_disable = SUCCESSFUL; + } + if (last_disable == SUCCESSFUL) { + if (arg_debug) + printf("Disable %s\n", filename); + if (op == BLACKLIST_FILE) + fs_logger2("blacklist", filename); + else + fs_logger2("blacklist-nolog", filename); + } + else { + if (arg_debug) + printf("Warning: %s is an invalid file, skipping...\n", filename); + } + + return; + } // if the file is not present, do nothing struct stat s; -- cgit v1.2.3-54-g00ecf