aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile.in16
-rwxr-xr-xgcov-test-init.sh11
-rw-r--r--src/firejail/fs_home.c3
-rw-r--r--src/firejail/preproc.c12
-rw-r--r--src/firejail/pulseaudio.c4
-rwxr-xr-xtest/apps-x11/xterm-xpra.exp12
-rwxr-xr-xtest/environment/environment.sh6
-rwxr-xr-xtest/rlimit/rlimit-profile.exp (renamed from test/environment/rlimit-profile.exp)0
-rwxr-xr-xtest/rlimit/rlimit.exp (renamed from test/environment/rlimit.exp)0
-rw-r--r--test/rlimit/rlimit.profile (renamed from test/environment/rlimit.profile)0
-rwxr-xr-xtest/root/apache2.exp4
-rwxr-xr-xtest/root/isc-dhcp.exp9
-rwxr-xr-xtest/root/nginx.exp4
-rwxr-xr-xtest/root/root.sh6
-rwxr-xr-xtest/root/snmpd.exp10
-rwxr-xr-xtest/root/unbound.exp9
16 files changed, 30 insertions, 76 deletions
diff --git a/Makefile.in b/Makefile.in
index 8649475dd..86fd4f4b7 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -39,7 +39,6 @@ clean:
39 for dir in $(APPS) $(MYLIBS); do \ 39 for dir in $(APPS) $(MYLIBS); do \
40 $(MAKE) -C $$dir clean; \ 40 $(MAKE) -C $$dir clean; \
41 done 41 done
42 rm -fr gcov-file gcov-dir gcov-test-initialized
43 rm -f $(MANPAGES) $(MANPAGES:%=%.gz) firejail*.rpm 42 rm -f $(MANPAGES) $(MANPAGES:%=%.gz) firejail*.rpm
44 rm -f test/utils/index.html* 43 rm -f test/utils/index.html*
45 rm -f test/utils/wget-log 44 rm -f test/utils/wget-log
@@ -146,7 +145,7 @@ uninstall:
146 rm -f $(DESTDIR)/$(datarootdir)/bash-completion/completions/firecfg 145 rm -f $(DESTDIR)/$(datarootdir)/bash-completion/completions/firecfg
147 146
148DISTFILES = "src etc platform configure configure.ac Makefile.in install.sh mkman.sh mketc.sh mkdeb.sh mkuid.sh COPYING README RELNOTES" 147DISTFILES = "src etc platform configure configure.ac Makefile.in install.sh mkman.sh mketc.sh mkdeb.sh mkuid.sh COPYING README RELNOTES"
149DISTFILES_TEST = "test/apps test/apps-x11 test/apps-x11-xorg test/root test/environment test/profiles test/utils test/compile test/filters test/network test/arguments test/fs test/sysutils" 148DISTFILES_TEST = "test/rlimit test/apps test/apps-x11 test/apps-x11-xorg test/root test/environment test/profiles test/utils test/compile test/filters test/network test/arguments test/fs test/sysutils"
150 149
151dist: 150dist:
152 mv config.status config.status.old 151 mv config.status config.status.old
@@ -188,14 +187,6 @@ cppcheck: clean
188scan-build: clean 187scan-build: clean
189 scan-build make 188 scan-build make
190 189
191gcov-test-initialized:
192 ./gcov-test-init.sh
193
194gcov: gcov-test-initialized
195 lcov --capture -d src/firejail -d src/firemon -d src/fseccomp -d src/fnet -d src/ftee -d src/lib -d src/firecfg --output-file gcov-file
196 rm -fr gcov-dir
197 genhtml gcov-file --output-directory gcov-dir
198
199 190
200# 191#
201# make test 192# make test
@@ -232,7 +223,10 @@ test-arguments:
232test-fs: 223test-fs:
233 cd test/fs; ./fs.sh | grep TESTING 224 cd test/fs; ./fs.sh | grep TESTING
234 225
235test: test-profiles test-fs test-utils test-environment test-apps test-apps-x11 test-apps-x11-xorg test-filters test-arguments 226test-rlimit:
227 cd test/rlimit; ./rlimit.sh | grep TESTING
228
229test: test-profiles test-fs test-utils test-environment test-apps test-apps-x11 test-apps-x11-xorg test-filters test-arguments test-rlimit
236 echo "TEST COMPLETE" 230 echo "TEST COMPLETE"
237 231
238########################################## 232##########################################
diff --git a/gcov-test-init.sh b/gcov-test-init.sh
deleted file mode 100755
index e98d9fa79..000000000
--- a/gcov-test-init.sh
+++ /dev/null
@@ -1,11 +0,0 @@
1#!/bin/bash
2
3USER=`whoami`
4firejail --help
5firemon --help
6/usr/lib/firejail/fnet --help
7/usr/lib/firejail/fseccomp --help
8/usr/lib/firejail/ftee --help
9firecfg --help
10sudo chown $USER:$USER `find .`
11touch gcov-test-initialized
diff --git a/src/firejail/fs_home.c b/src/firejail/fs_home.c
index 91fbe592a..242482d26 100644
--- a/src/firejail/fs_home.c
+++ b/src/firejail/fs_home.c
@@ -626,6 +626,9 @@ void fs_private_home_list(void) {
626 626
627 fs_logger_print(); // save the current log 627 fs_logger_print(); // save the current log
628 free(dlist); 628 free(dlist);
629#ifdef HAVE_GCOV
630 __gcov_flush();
631#endif
629 _exit(0); 632 _exit(0);
630 } 633 }
631 // wait for the child to finish 634 // wait for the child to finish
diff --git a/src/firejail/preproc.c b/src/firejail/preproc.c
index fe5f2eb44..ea4e6743f 100644
--- a/src/firejail/preproc.c
+++ b/src/firejail/preproc.c
@@ -104,16 +104,8 @@ void preproc_build_cp_command(void) {
104 preproc_mount_mnt_dir(); 104 preproc_mount_mnt_dir();
105 if (stat(RUN_CP_COMMAND, &s)) { 105 if (stat(RUN_CP_COMMAND, &s)) {
106 char* fname = realpath("/bin/cp", NULL); 106 char* fname = realpath("/bin/cp", NULL);
107 if (fname == NULL) { 107 if (fname == NULL || stat(fname, &s) || is_link(fname)) {
108 fprintf(stderr, "Error: /bin/cp not found\n"); 108 fprintf(stderr, "Error: invalid /bin/cp\n");
109 exit(1);
110 }
111 if (stat(fname, &s)) {
112 fprintf(stderr, "Error: /bin/cp not found\n");
113 exit(1);
114 }
115 if (is_link(fname)) {
116 fprintf(stderr, "Error: invalid /bin/cp file\n");
117 exit(1); 109 exit(1);
118 } 110 }
119 int rv = copy_file(fname, RUN_CP_COMMAND, 0, 0, 0755); 111 int rv = copy_file(fname, RUN_CP_COMMAND, 0, 0, 0755);
diff --git a/src/firejail/pulseaudio.c b/src/firejail/pulseaudio.c
index c76505591..6ec590eaa 100644
--- a/src/firejail/pulseaudio.c
+++ b/src/firejail/pulseaudio.c
@@ -130,7 +130,7 @@ void pulseaudio_init(void) {
130 int rv = mkdir(dir1, 0755); 130 int rv = mkdir(dir1, 0755);
131 if (rv == 0) { 131 if (rv == 0) {
132 if (set_perms(dir1, getuid(), getgid(), 0755)) 132 if (set_perms(dir1, getuid(), getgid(), 0755))
133 ; // do nothing 133 {;} // do nothing
134 } 134 }
135 } 135 }
136 free(dir1); 136 free(dir1);
@@ -140,7 +140,7 @@ void pulseaudio_init(void) {
140 int rv = mkdir(dir1, 0700); 140 int rv = mkdir(dir1, 0700);
141 if (rv == 0) { 141 if (rv == 0) {
142 if (set_perms(dir1, getuid(), getgid(), 0700)) 142 if (set_perms(dir1, getuid(), getgid(), 0700))
143 ; // do nothing 143 {;} // do nothing
144 } 144 }
145 } 145 }
146 free(dir1); 146 free(dir1);
diff --git a/test/apps-x11/xterm-xpra.exp b/test/apps-x11/xterm-xpra.exp
index 379de131a..1fb5df486 100755
--- a/test/apps-x11/xterm-xpra.exp
+++ b/test/apps-x11/xterm-xpra.exp
@@ -79,6 +79,18 @@ expect {
79 "name=blablabla" 79 "name=blablabla"
80} 80}
81sleep 1 81sleep 1
82
83send -- "firemon --x11\r"
84expect {
85 timeout {puts "TESTING ERROR 7\n";exit}
86 "name=test xterm"
87}
88expect {
89 timeout {puts "TESTING ERROR 7.1\n";exit}
90 "DISPLAY"
91}
92sleep 1
93
82send -- "firejail --shutdown=test\r" 94send -- "firejail --shutdown=test\r"
83sleep 3 95sleep 3
84 96
diff --git a/test/environment/environment.sh b/test/environment/environment.sh
index 04a1daaf6..5c4d49331 100755
--- a/test/environment/environment.sh
+++ b/test/environment/environment.sh
@@ -55,12 +55,6 @@ else
55 echo "TESTING SKIP: zsh not found" 55 echo "TESTING SKIP: zsh not found"
56fi 56fi
57 57
58echo "TESTING: rlimit (test/environment/rlimit.exp)"
59./rlimit.exp
60
61echo "TESTING: rlimit profile (test/environment/rlimit-profile.exp)"
62./rlimit-profile.exp
63
64echo "TESTING: firejail in firejail - single sandbox (test/environment/firejail-in-firejail.exp)" 58echo "TESTING: firejail in firejail - single sandbox (test/environment/firejail-in-firejail.exp)"
65./firejail-in-firejail.exp 59./firejail-in-firejail.exp
66 60
diff --git a/test/environment/rlimit-profile.exp b/test/rlimit/rlimit-profile.exp
index a9e54a405..a9e54a405 100755
--- a/test/environment/rlimit-profile.exp
+++ b/test/rlimit/rlimit-profile.exp
diff --git a/test/environment/rlimit.exp b/test/rlimit/rlimit.exp
index 611f69821..611f69821 100755
--- a/test/environment/rlimit.exp
+++ b/test/rlimit/rlimit.exp
diff --git a/test/environment/rlimit.profile b/test/rlimit/rlimit.profile
index 271891c03..271891c03 100644
--- a/test/environment/rlimit.profile
+++ b/test/rlimit/rlimit.profile
diff --git a/test/root/apache2.exp b/test/root/apache2.exp
index 7f67f4706..0b102bad5 100755
--- a/test/root/apache2.exp
+++ b/test/root/apache2.exp
@@ -4,10 +4,6 @@ set timeout 5
4spawn $env(SHELL) 4spawn $env(SHELL)
5match_max 100000 5match_max 100000
6 6
7send -- "pkill apache\r"
8sleep 2
9
10
11send -- "firejail --name=apache /etc/init.d/apache2 start\r" 7send -- "firejail --name=apache /etc/init.d/apache2 start\r"
12expect { 8expect {
13 timeout {puts "TESTING ERROR 0\n";exit} 9 timeout {puts "TESTING ERROR 0\n";exit}
diff --git a/test/root/isc-dhcp.exp b/test/root/isc-dhcp.exp
index 86500707a..5d9597e7c 100755
--- a/test/root/isc-dhcp.exp
+++ b/test/root/isc-dhcp.exp
@@ -4,15 +4,6 @@ set timeout 5
4spawn $env(SHELL) 4spawn $env(SHELL)
5match_max 100000 5match_max 100000
6 6
7send -- "sudo ls; sudo whoami; sudo pwd\r"
8expect {
9 timeout {puts "TESTING ERROR: you need to root run this test as root\n";exit}
10 "root"
11}
12
13send -- "pkill dhcpd\r"
14sleep 2
15
16send -- "firejail --name=dhcpd /etc/init.d/isc-dhcp-server start\r" 7send -- "firejail --name=dhcpd /etc/init.d/isc-dhcp-server start\r"
17expect { 8expect {
18 timeout {puts "TESTING ERROR 0\n";exit} 9 timeout {puts "TESTING ERROR 0\n";exit}
diff --git a/test/root/nginx.exp b/test/root/nginx.exp
index 0b62fada9..82ebe0ee7 100755
--- a/test/root/nginx.exp
+++ b/test/root/nginx.exp
@@ -4,10 +4,6 @@ set timeout 5
4spawn $env(SHELL) 4spawn $env(SHELL)
5match_max 100000 5match_max 100000
6 6
7send -- "pkill nginx\r"
8sleep 2
9
10
11send -- "firejail --name=nginx /etc/init.d/nginx start\r" 7send -- "firejail --name=nginx /etc/init.d/nginx start\r"
12expect { 8expect {
13 timeout {puts "TESTING ERROR 0\n";exit} 9 timeout {puts "TESTING ERROR 0\n";exit}
diff --git a/test/root/root.sh b/test/root/root.sh
index 471b7d535..494bd4fe7 100755
--- a/test/root/root.sh
+++ b/test/root/root.sh
@@ -48,6 +48,12 @@ else
48fi 48fi
49 49
50#******************************** 50#********************************
51# filesystem
52#********************************
53echo "TESTING: fs private (test/root/private.exp)"
54./private.exp
55
56#********************************
51# seccomp 57# seccomp
52#******************************** 58#********************************
53echo "TESTING: seccomp umount (test/root/seccomp-umount.exp)" 59echo "TESTING: seccomp umount (test/root/seccomp-umount.exp)"
diff --git a/test/root/snmpd.exp b/test/root/snmpd.exp
index 90e34470f..610fdb13a 100755
--- a/test/root/snmpd.exp
+++ b/test/root/snmpd.exp
@@ -4,16 +4,6 @@ set timeout 5
4spawn $env(SHELL) 4spawn $env(SHELL)
5match_max 100000 5match_max 100000
6 6
7send -- "sudo ls; sudo whoami; sudo pwd\r"
8expect {
9 timeout {puts "TESTING ERROR: you need to root run this test as root\n";exit}
10 "root"
11}
12
13send -- "pkill snmpd\r"
14sleep 2
15
16
17send -- "firejail --name=snmpd /etc/init.d/snmpd start\r" 7send -- "firejail --name=snmpd /etc/init.d/snmpd start\r"
18expect { 8expect {
19 timeout {puts "TESTING ERROR 0\n";exit} 9 timeout {puts "TESTING ERROR 0\n";exit}
diff --git a/test/root/unbound.exp b/test/root/unbound.exp
index 193e662ff..9c496306a 100755
--- a/test/root/unbound.exp
+++ b/test/root/unbound.exp
@@ -4,15 +4,6 @@ set timeout 5
4spawn $env(SHELL) 4spawn $env(SHELL)
5match_max 100000 5match_max 100000
6 6
7send -- "sudo ls; sudo whoami; sudo pwd\r"
8expect {
9 timeout {puts "TESTING ERROR: you need to root run this test as root\n";exit}
10 "root"
11}
12
13send -- "pkill unbound\r"
14sleep 2
15
16send -- "firejail --name=unbound unbound\r" 7send -- "firejail --name=unbound unbound\r"
17expect { 8expect {
18 timeout {puts "TESTING ERROR 0\n";exit} 9 timeout {puts "TESTING ERROR 0\n";exit}