diff options
author | netblue30 <netblue30@yahoo.com> | 2016-12-06 11:07:25 -0500 |
---|---|---|
committer | netblue30 <netblue30@yahoo.com> | 2016-12-06 11:07:25 -0500 |
commit | 96b67ed4ed768e0d37c6e22334031cd302982509 (patch) | |
tree | 24f26ac5af9e961c5a24d9d77f89b59b1b75f547 | |
parent | testing (diff) | |
download | firejail-96b67ed4ed768e0d37c6e22334031cd302982509.tar.gz firejail-96b67ed4ed768e0d37c6e22334031cd302982509.tar.zst firejail-96b67ed4ed768e0d37c6e22334031cd302982509.zip |
fixes
-rw-r--r-- | src/firejail/main.c | 11 | ||||
-rw-r--r-- | src/firejail/no_sandbox.c | 1 | ||||
-rwxr-xr-x | test/environment/firejail-in-firejail.exp | 27 | ||||
-rwxr-xr-x | test/environment/firejail-in-firejail2.exp | 29 |
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 | ||
17 | send -- "firejail\r" | 17 | send -- "firejail\r" |
18 | expect { | 18 | expect { |
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 | } |
22 | after 100 | 22 | after 100 |
23 | 23 | ||
24 | send -- "exit\r" | ||
25 | after 100 | ||
26 | |||
27 | send -- "firejail --force\r" | ||
28 | expect { | ||
29 | timeout {puts "TESTING ERROR 3\n";exit} | ||
30 | "cannot rise privileges" | ||
31 | } | ||
32 | after 100 | ||
33 | |||
34 | send -- "firejail --version\r" | ||
35 | expect { | ||
36 | timeout {puts "TESTING ERROR 4\n";exit} | ||
37 | "firejail version" | ||
38 | } | ||
39 | after 100 | ||
40 | |||
41 | send -- "firejail --version --force\r" | ||
42 | expect { | ||
43 | timeout {puts "TESTING ERROR 5\n";exit} | ||
44 | "firejail version" | ||
45 | } | ||
46 | after 100 | ||
47 | |||
48 | |||
24 | puts "\nall done\n" | 49 | puts "\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 | } |
15 | sleep 1 | 15 | sleep 1 |
16 | 16 | ||
17 | send -- "firejail\r" | ||
18 | expect { | ||
19 | timeout {puts "TESTING ERROR 2\n";exit} | ||
20 | "Warning: an existing sandbox was detected" | ||
21 | } | ||
22 | after 100 | ||
23 | |||
24 | send -- "exit\r" | ||
25 | after 100 | ||
26 | |||
17 | send -- "firejail --force\r" | 27 | send -- "firejail --force\r" |
18 | expect { | 28 | expect { |
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 | } |
22 | after 100 | 32 | after 100 |
23 | 33 | ||
34 | send -- "exit\r" | ||
35 | after 100 | ||
36 | |||
37 | send -- "firejail --version\r" | ||
38 | expect { | ||
39 | timeout {puts "TESTING ERROR 4\n";exit} | ||
40 | "firejail version" | ||
41 | } | ||
42 | after 100 | ||
43 | |||
44 | send -- "firejail --version --force\r" | ||
45 | expect { | ||
46 | timeout {puts "TESTING ERROR 5\n";exit} | ||
47 | "firejail version" | ||
48 | } | ||
49 | after 100 | ||
50 | |||
24 | puts "\nall done\n" | 51 | puts "\nall done\n" |