diff options
-rw-r--r-- | src/firejail/fs_logger.c | 2 | ||||
-rwxr-xr-x | test/fs-print.exp | 29 | ||||
-rwxr-xr-x | test/test.sh | 3 |
3 files changed, 34 insertions, 0 deletions
diff --git a/src/firejail/fs_logger.c b/src/firejail/fs_logger.c index 227a66cd7..30b0fe438 100644 --- a/src/firejail/fs_logger.c +++ b/src/firejail/fs_logger.c | |||
@@ -141,7 +141,9 @@ void fs_logger_print_log(pid_t pid) { | |||
141 | EUID_ASSERT(); | 141 | EUID_ASSERT(); |
142 | 142 | ||
143 | // if the pid is that of a firejail process, use the pid of the first child process | 143 | // if the pid is that of a firejail process, use the pid of the first child process |
144 | EUID_ROOT(); | ||
144 | char *comm = pid_proc_comm(pid); | 145 | char *comm = pid_proc_comm(pid); |
146 | EUID_USER(); | ||
145 | if (comm) { | 147 | if (comm) { |
146 | if (strcmp(comm, "firejail") == 0) { | 148 | if (strcmp(comm, "firejail") == 0) { |
147 | pid_t child; | 149 | pid_t child; |
diff --git a/test/fs-print.exp b/test/fs-print.exp new file mode 100755 index 000000000..48056a3bf --- /dev/null +++ b/test/fs-print.exp | |||
@@ -0,0 +1,29 @@ | |||
1 | #!/usr/bin/expect -f | ||
2 | |||
3 | set timeout 10 | ||
4 | spawn $env(SHELL) | ||
5 | match_max 100000 | ||
6 | |||
7 | send -- "firejail --name=test\r" | ||
8 | expect { | ||
9 | timeout {puts "TESTING ERROR 0\n";exit} | ||
10 | "Child process initialized" | ||
11 | } | ||
12 | sleep 2 | ||
13 | |||
14 | spawn $env(SHELL) | ||
15 | send -- "firejail --fs.print=test\r" | ||
16 | expect { | ||
17 | timeout {puts "TESTING ERROR 1\n";exit} | ||
18 | "blacklist /boot" | ||
19 | } | ||
20 | expect { | ||
21 | timeout {puts "TESTING ERROR 2\n";exit} | ||
22 | "blacklist /dev/kmsg" | ||
23 | } | ||
24 | expect { | ||
25 | timeout {puts "TESTING ERROR 3\n";exit} | ||
26 | "blacklist /proc/kmsg" | ||
27 | } | ||
28 | sleep 1 | ||
29 | puts "\nall done\n" | ||
diff --git a/test/test.sh b/test/test.sh index c8720044a..417d41810 100755 --- a/test/test.sh +++ b/test/test.sh | |||
@@ -6,6 +6,9 @@ | |||
6 | 6 | ||
7 | ./fscheck.sh | 7 | ./fscheck.sh |
8 | 8 | ||
9 | echo "TESTING: fs.print (fs-print.exp)" | ||
10 | ./fs-print.exp | ||
11 | |||
9 | echo "TESTING: caps.print (caps-print.exp)" | 12 | echo "TESTING: caps.print (caps-print.exp)" |
10 | ./caps-print.exp | 13 | ./caps-print.exp |
11 | 14 | ||