aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@yahoo.com>2016-12-06 11:07:25 -0500
committerLibravatar netblue30 <netblue30@yahoo.com>2016-12-06 11:07:25 -0500
commit96b67ed4ed768e0d37c6e22334031cd302982509 (patch)
tree24f26ac5af9e961c5a24d9d77f89b59b1b75f547
parenttesting (diff)
downloadfirejail-96b67ed4ed768e0d37c6e22334031cd302982509.tar.gz
firejail-96b67ed4ed768e0d37c6e22334031cd302982509.tar.zst
firejail-96b67ed4ed768e0d37c6e22334031cd302982509.zip
fixes
-rw-r--r--src/firejail/main.c11
-rw-r--r--src/firejail/no_sandbox.c1
-rwxr-xr-xtest/environment/firejail-in-firejail.exp27
-rwxr-xr-xtest/environment/firejail-in-firejail2.exp29
4 files changed, 63 insertions, 5 deletions
diff --git a/src/firejail/main.c b/src/firejail/main.c
index 545c38018..b25bad9f2 100644
--- a/src/firejail/main.c
+++ b/src/firejail/main.c
@@ -774,7 +774,7 @@ static int check_arg(int argc, char **argv, const char *argument) {
774 int i; 774 int i;
775 int found = 0; 775 int found = 0;
776 for (i = 1; i < argc; i++) { 776 for (i = 1; i < argc; i++) {
777 if (strcmp(argv[i], "--force") == 0) { 777 if (strcmp(argv[i], argument) == 0) {
778 found = 1; 778 found = 1;
779 break; 779 break;
780 } 780 }
@@ -833,6 +833,11 @@ int main(int argc, char **argv) {
833 if (check_arg(argc, argv, "--force")) 833 if (check_arg(argc, argv, "--force"))
834 option_force = 1; 834 option_force = 1;
835 else { 835 else {
836 if (check_arg(argc, argv, "--version")) {
837 printf("firejail version %s\n", VERSION);
838 exit(0);
839 }
840
836 // start the program directly without sandboxing 841 // start the program directly without sandboxing
837 run_no_sandbox(argc, argv); 842 run_no_sandbox(argc, argv);
838 // it will never get here! 843 // it will never get here!
@@ -840,12 +845,12 @@ int main(int argc, char **argv) {
840 } 845 }
841 } 846 }
842 } 847 }
843 848
844 // check root/suid 849 // check root/suid
845 EUID_ROOT(); 850 EUID_ROOT();
846 if (geteuid()) { 851 if (geteuid()) {
847 // only --version is supported without SUID support 852 // only --version is supported without SUID support
848 if (check_arg(argc, argv, "--force")) { 853 if (check_arg(argc, argv, "--version")) {
849 printf("firejail version %s\n", VERSION); 854 printf("firejail version %s\n", VERSION);
850 exit(0); 855 exit(0);
851 } 856 }
diff --git a/src/firejail/no_sandbox.c b/src/firejail/no_sandbox.c
index 07ac25dca..c56d90994 100644
--- a/src/firejail/no_sandbox.c
+++ b/src/firejail/no_sandbox.c
@@ -229,5 +229,6 @@ void run_no_sandbox(int argc, char **argv) {
229 fprintf(stderr, "Warning: an existing sandbox was detected. " 229 fprintf(stderr, "Warning: an existing sandbox was detected. "
230 "%s will run without any additional sandboxing features\n", command); 230 "%s will run without any additional sandboxing features\n", command);
231 231
232 arg_quiet = 1;
232 start_application(); 233 start_application();
233} 234}
diff --git a/test/environment/firejail-in-firejail.exp b/test/environment/firejail-in-firejail.exp
index 1122b712f..2b851ee72 100755
--- a/test/environment/firejail-in-firejail.exp
+++ b/test/environment/firejail-in-firejail.exp
@@ -16,9 +16,34 @@ sleep 1
16 16
17send -- "firejail\r" 17send -- "firejail\r"
18expect { 18expect {
19 timeout {puts "TESTING ERROR 1\n";exit} 19 timeout {puts "TESTING ERROR 2\n";exit}
20 "Warning: an existing sandbox was detected" 20 "Warning: an existing sandbox was detected"
21} 21}
22after 100 22after 100
23 23
24send -- "exit\r"
25after 100
26
27send -- "firejail --force\r"
28expect {
29 timeout {puts "TESTING ERROR 3\n";exit}
30 "cannot rise privileges"
31}
32after 100
33
34send -- "firejail --version\r"
35expect {
36 timeout {puts "TESTING ERROR 4\n";exit}
37 "firejail version"
38}
39after 100
40
41send -- "firejail --version --force\r"
42expect {
43 timeout {puts "TESTING ERROR 5\n";exit}
44 "firejail version"
45}
46after 100
47
48
24puts "\nall done\n" 49puts "\nall done\n"
diff --git a/test/environment/firejail-in-firejail2.exp b/test/environment/firejail-in-firejail2.exp
index 37d1c2870..330e5e372 100755
--- a/test/environment/firejail-in-firejail2.exp
+++ b/test/environment/firejail-in-firejail2.exp
@@ -14,11 +14,38 @@ expect {
14} 14}
15sleep 1 15sleep 1
16 16
17send -- "firejail\r"
18expect {
19 timeout {puts "TESTING ERROR 2\n";exit}
20 "Warning: an existing sandbox was detected"
21}
22after 100
23
24send -- "exit\r"
25after 100
26
17send -- "firejail --force\r" 27send -- "firejail --force\r"
18expect { 28expect {
19 timeout {puts "TESTING ERROR 1\n";exit} 29 timeout {puts "TESTING ERROR 3\n";exit}
20 "Child process initialized" 30 "Child process initialized"
21} 31}
22after 100 32after 100
23 33
34send -- "exit\r"
35after 100
36
37send -- "firejail --version\r"
38expect {
39 timeout {puts "TESTING ERROR 4\n";exit}
40 "firejail version"
41}
42after 100
43
44send -- "firejail --version --force\r"
45expect {
46 timeout {puts "TESTING ERROR 5\n";exit}
47 "firejail version"
48}
49after 100
50
24puts "\nall done\n" 51puts "\nall done\n"