From 1e00f7247e04fa85e7585810cfa6ab10ecc5d53d Mon Sep 17 00:00:00 2001 From: smitsohu Date: Sat, 29 Jun 2019 14:52:20 +0200 Subject: fix option skipping caused by noblacklist closes #1235 --- src/firejail/fs.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/firejail/fs.c b/src/firejail/fs.c index 14d7d7156..9a15d825e 100644 --- a/src/firejail/fs.c +++ b/src/firejail/fs.c @@ -204,21 +204,23 @@ static void globbing(OPERATION op, const char *pattern, const char *noblacklist[ continue; // noblacklist is expected to be short in normal cases, so stupid and correct brute force is okay bool okay_to_blacklist = true; - for (j = 0; j < noblacklist_len; j++) { - int result = fnmatch(noblacklist[j], path, FNM_PATHNAME); - if (result == FNM_NOMATCH) - continue; - else if (result == 0) { - okay_to_blacklist = false; + if (op == BLACKLIST_FILE || op == BLACKLIST_NOLOG) { + for (j = 0; j < noblacklist_len; j++) { + int result = fnmatch(noblacklist[j], path, FNM_PATHNAME); + if (result == FNM_NOMATCH) + continue; + else if (result == 0) { + okay_to_blacklist = false; #ifdef TEST_NO_BLACKLIST_MATCHING - if (j < nbcheck_size) // noblacklist checking - nbcheck[j] = 1; + if (j < nbcheck_size) // noblacklist checking + nbcheck[j] = 1; #endif - break; - } - else { - fprintf(stderr, "Error: failed to compare path %s with pattern %s\n", path, noblacklist[j]); - exit(1); + break; + } + else { + fprintf(stderr, "Error: failed to compare path %s with pattern %s\n", path, noblacklist[j]); + exit(1); + } } } -- cgit v1.2.3-54-g00ecf