diff options
-rw-r--r-- | src/firejail/fs.c | 2 | ||||
-rwxr-xr-x | test/fs/fs.sh | 3 | ||||
-rwxr-xr-x | test/fs/option_blacklist_glob.exp | 32 | ||||
-rw-r--r-- | test/fs/testdir1/.directory/file | 0 | ||||
-rw-r--r-- | test/fs/testdir1/.file | 0 |
5 files changed, 36 insertions, 1 deletions
diff --git a/src/firejail/fs.c b/src/firejail/fs.c index cfb724696..c38a9a32e 100644 --- a/src/firejail/fs.c +++ b/src/firejail/fs.c | |||
@@ -361,7 +361,7 @@ static void globbing(OPERATION op, const char *pattern, const char *noblacklist[ | |||
361 | glob_t globbuf; | 361 | glob_t globbuf; |
362 | // Profiles contain blacklists for files that might not exist on a user's machine. | 362 | // Profiles contain blacklists for files that might not exist on a user's machine. |
363 | // GLOB_NOCHECK makes that okay. | 363 | // GLOB_NOCHECK makes that okay. |
364 | int globerr = glob(pattern, GLOB_NOCHECK | GLOB_NOSORT, NULL, &globbuf); | 364 | int globerr = glob(pattern, GLOB_NOCHECK | GLOB_NOSORT | GLOB_PERIOD, NULL, &globbuf); |
365 | if (globerr) { | 365 | if (globerr) { |
366 | fprintf(stderr, "Error: failed to glob pattern %s\n", pattern); | 366 | fprintf(stderr, "Error: failed to glob pattern %s\n", pattern); |
367 | exit(1); | 367 | exit(1); |
diff --git a/test/fs/fs.sh b/test/fs/fs.sh index b49aadf02..08888020c 100755 --- a/test/fs/fs.sh +++ b/test/fs/fs.sh | |||
@@ -45,6 +45,9 @@ echo "TESTING: blacklist directory (test/fs/option_blacklist.exp)" | |||
45 | echo "TESTING: blacklist file (test/fs/option_blacklist_file.exp)" | 45 | echo "TESTING: blacklist file (test/fs/option_blacklist_file.exp)" |
46 | ./option_blacklist_file.exp | 46 | ./option_blacklist_file.exp |
47 | 47 | ||
48 | echo "TESTING: blacklist glob (test/fs/option_blacklist_glob.exp)" | ||
49 | ./option_blacklist_glob.exp | ||
50 | |||
48 | echo "TESTING: bind as user (test/fs/option_bind_user.exp)" | 51 | echo "TESTING: bind as user (test/fs/option_bind_user.exp)" |
49 | ./option_bind_user.exp | 52 | ./option_bind_user.exp |
50 | 53 | ||
diff --git a/test/fs/option_blacklist_glob.exp b/test/fs/option_blacklist_glob.exp new file mode 100755 index 000000000..01939736d --- /dev/null +++ b/test/fs/option_blacklist_glob.exp | |||
@@ -0,0 +1,32 @@ | |||
1 | #!/usr/bin/expect -f | ||
2 | # This file is part of Firejail project | ||
3 | # Copyright (C) 2014-2016 Firejail Authors | ||
4 | # License GPL v2 | ||
5 | |||
6 | set timeout 10 | ||
7 | spawn $env(SHELL) | ||
8 | match_max 100000 | ||
9 | |||
10 | send -- "firejail --blacklist=testdir1/*\r" | ||
11 | expect { | ||
12 | timeout {puts "TESTING ERROR 0\n";exit} | ||
13 | "Child process initialized" | ||
14 | } | ||
15 | sleep 1 | ||
16 | send -- "cd testdir1\r" | ||
17 | sleep 1 | ||
18 | |||
19 | send -- "cat .file\r" | ||
20 | expect { | ||
21 | timeout {puts "TESTING ERROR 1\n";exit} | ||
22 | "Permission denied" | ||
23 | } | ||
24 | |||
25 | send -- "ls .directory\r" | ||
26 | expect { | ||
27 | timeout {puts "TESTING ERROR 2\n";exit} | ||
28 | "Permission denied" | ||
29 | } | ||
30 | |||
31 | puts "\n" | ||
32 | |||
diff --git a/test/fs/testdir1/.directory/file b/test/fs/testdir1/.directory/file new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/test/fs/testdir1/.directory/file | |||
diff --git a/test/fs/testdir1/.file b/test/fs/testdir1/.file new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/test/fs/testdir1/.file | |||