aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@yahoo.com>2015-10-25 08:22:21 -0400
committerLibravatar netblue30 <netblue30@yahoo.com>2015-10-25 08:22:21 -0400
commit113597818860241185d0c3efecf99b0ee7d900fa (patch)
tree3e9e40cad8a5cf976c331e850e6c423f24e0d1ae
parentimplemented --ignore option (diff)
downloadfirejail-113597818860241185d0c3efecf99b0ee7d900fa.tar.gz
firejail-113597818860241185d0c3efecf99b0ee7d900fa.tar.zst
firejail-113597818860241185d0c3efecf99b0ee7d900fa.zip
ignore option testing
-rw-r--r--src/firejail/main.c6
-rwxr-xr-xtest/ignore.exp38
-rw-r--r--test/ignore.profile3
-rwxr-xr-xtest/test.sh3
4 files changed, 49 insertions, 1 deletions
diff --git a/src/firejail/main.c b/src/firejail/main.c
index 0def00fa8..8d11caef3 100644
--- a/src/firejail/main.c
+++ b/src/firejail/main.c
@@ -712,7 +712,11 @@ int main(int argc, char **argv) {
712 arg_noprofile = 1; 712 arg_noprofile = 1;
713 } 713 }
714 else if (strncmp(argv[i], "--ignore=", 9) == 0) { 714 else if (strncmp(argv[i], "--ignore=", 9) == 0) {
715 char *ptr = argv[i] + 9; 715 if (custom_profile) {
716 fprintf(stderr, "Error: please use --profile after --include\n");
717 exit(1);
718 }
719
716 if (*(argv[i] + 9) == '\0') { 720 if (*(argv[i] + 9) == '\0') {
717 fprintf(stderr, "Error: invalid ignore option\n"); 721 fprintf(stderr, "Error: invalid ignore option\n");
718 exit(1); 722 exit(1);
diff --git a/test/ignore.exp b/test/ignore.exp
new file mode 100755
index 000000000..bdbd9d28c
--- /dev/null
+++ b/test/ignore.exp
@@ -0,0 +1,38 @@
1#!/usr/bin/expect -f
2
3set timeout 10
4spawn $env(SHELL)
5match_max 100000
6
7send -- "firejail --profile=ignore.profile --ignore=seccomp \r"
8expect {
9 timeout {puts "TESTING ERROR 0\n";exit}
10 "Error: please use --profile after --include"
11}
12
13send -- "firejail --debug --ignore=seccomp\r"
14expect {
15 timeout {puts "TESTING ERROR 1\n";exit}
16 BLACKLIST {puts "TESTING ERROR 2\n";exit}
17 "Child process initialized"
18}
19sleep 1
20send -- "exit\r"
21sleep 1
22
23send -- "firejail --ignore=seccomp --ignore=shell --profile=ignore.profile \r"
24expect {
25 timeout {puts "TESTING ERROR 3\n";exit}
26 "Child process initialized"
27}
28sleep 1
29
30send -- "ps aux | wc -l\r"
31expect {
32 timeout {puts "TESTING ERROR 4\n";exit}
33 "4"
34}
35sleep 1
36
37
38puts "\nall done\n"
diff --git a/test/ignore.profile b/test/ignore.profile
new file mode 100644
index 000000000..aec231ad2
--- /dev/null
+++ b/test/ignore.profile
@@ -0,0 +1,3 @@
1private
2seccomp
3shell none
diff --git a/test/test.sh b/test/test.sh
index c986b5f29..406ef92a3 100755
--- a/test/test.sh
+++ b/test/test.sh
@@ -18,6 +18,9 @@ echo "TESTING: invalid filename"
18echo "TESTING: environment variables" 18echo "TESTING: environment variables"
19./env.exp 19./env.exp
20 20
21echo "TESTING: ignore command"
22./ignore.exp
23
21echo "TESTING: private-etc" 24echo "TESTING: private-etc"
22./private-etc.exp 25./private-etc.exp
23 26