aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@yahoo.com>2016-04-06 10:14:35 -0400
committerLibravatar netblue30 <netblue30@yahoo.com>2016-04-06 10:14:35 -0400
commitad9cb9724701e5aba9e90d3dbf00f9b89e335e3c (patch)
tree8d732ddadcb0c320744c2417a5845aa3113c7b9e
parentgrsecurity: --seccomp.print (diff)
downloadfirejail-ad9cb9724701e5aba9e90d3dbf00f9b89e335e3c.tar.gz
firejail-ad9cb9724701e5aba9e90d3dbf00f9b89e335e3c.tar.zst
firejail-ad9cb9724701e5aba9e90d3dbf00f9b89e335e3c.zip
grsecurity: --protocol.print
-rw-r--r--src/firejail/protocol.c2
-rwxr-xr-xtest/protocol-print.exp21
-rwxr-xr-xtest/test.sh7
3 files changed, 28 insertions, 2 deletions
diff --git a/src/firejail/protocol.c b/src/firejail/protocol.c
index 70b8496ec..7e5ab7dfb 100644
--- a/src/firejail/protocol.c
+++ b/src/firejail/protocol.c
@@ -339,7 +339,9 @@ void protocol_print_filter(pid_t pid) {
339 (void) pid; 339 (void) pid;
340#ifdef SYS_socket 340#ifdef SYS_socket
341 // if the pid is that of a firejail process, use the pid of the first child process 341 // if the pid is that of a firejail process, use the pid of the first child process
342 EUID_ROOT();
342 char *comm = pid_proc_comm(pid); 343 char *comm = pid_proc_comm(pid);
344 EUID_USER();
343 if (comm) { 345 if (comm) {
344 if (strcmp(comm, "firejail") == 0) { 346 if (strcmp(comm, "firejail") == 0) {
345 pid_t child; 347 pid_t child;
diff --git a/test/protocol-print.exp b/test/protocol-print.exp
new file mode 100755
index 000000000..4d1ae34d6
--- /dev/null
+++ b/test/protocol-print.exp
@@ -0,0 +1,21 @@
1#!/usr/bin/expect -f
2
3set timeout 10
4spawn $env(SHELL)
5match_max 100000
6
7send -- "firejail --name=test\r"
8expect {
9 timeout {puts "TESTING ERROR 0\n";exit}
10 "Child process initialized"
11}
12sleep 2
13
14spawn $env(SHELL)
15send -- "firejail --protocol.print=test\r"
16expect {
17 timeout {puts "TESTING ERROR 1\n";exit}
18 "unix,inet,inet6"
19}
20sleep 1
21puts "\nall done\n"
diff --git a/test/test.sh b/test/test.sh
index 34a079d07..c8720044a 100755
--- a/test/test.sh
+++ b/test/test.sh
@@ -6,12 +6,15 @@
6 6
7./fscheck.sh 7./fscheck.sh
8 8
9echo "TESTING: caps.print (caps-print.exp) 9echo "TESTING: caps.print (caps-print.exp)"
10./caps-print.exp 10./caps-print.exp
11 11
12echo "TESTING: seccomp.print (seccomp-print.exp) 12echo "TESTING: seccomp.print (seccomp-print.exp)"
13./seccomp-print.exp 13./seccomp-print.exp
14 14
15echo "TESTING: protocol.print (protocol-print.exp)"
16./protocol-print.exp
17
15echo "TESTING: sound (sound.exp)" 18echo "TESTING: sound (sound.exp)"
16./sound.exp 19./sound.exp
17 20