diff options
Diffstat (limited to 'src/firejail/main.c')
-rw-r--r-- | src/firejail/main.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/firejail/main.c b/src/firejail/main.c index 87c8389ad..e0f2a676c 100644 --- a/src/firejail/main.c +++ b/src/firejail/main.c | |||
@@ -60,8 +60,6 @@ int arg_nonetwork = 0; // --net=none | |||
60 | int arg_command = 0; // -c | 60 | int arg_command = 0; // -c |
61 | int arg_overlay = 0; // overlay option | 61 | int arg_overlay = 0; // overlay option |
62 | int arg_overlay_keep = 0; // place overlay diff directory in ~/.firejail | 62 | int arg_overlay_keep = 0; // place overlay diff directory in ~/.firejail |
63 | int arg_zsh = 0; // use zsh as default shell | ||
64 | int arg_csh = 0; // use csh as default shell | ||
65 | 63 | ||
66 | int arg_seccomp = 0; // enable default seccomp filter | 64 | int arg_seccomp = 0; // enable default seccomp filter |
67 | 65 | ||
@@ -565,7 +563,18 @@ static void run_cmd_and_exit(int i, int argc, char **argv) { | |||
565 | #endif | 563 | #endif |
566 | else if (strncmp(argv[i], "--join=", 7) == 0) { | 564 | else if (strncmp(argv[i], "--join=", 7) == 0) { |
567 | logargs(argc, argv); | 565 | logargs(argc, argv); |
568 | 566 | ||
567 | if (arg_shell_none) { | ||
568 | if (argc <= (i+1)) { | ||
569 | fprintf(stderr, "Error: --shell=none set, but no command specified\n"); | ||
570 | exit(1); | ||
571 | } | ||
572 | cfg.original_program_index = i + 1; | ||
573 | } | ||
574 | |||
575 | if (!cfg.shell && !arg_shell_none) | ||
576 | cfg.shell = guess_shell(); | ||
577 | |||
569 | // join sandbox by pid or by name | 578 | // join sandbox by pid or by name |
570 | pid_t pid; | 579 | pid_t pid; |
571 | if (read_pid(argv[i] + 7, &pid) == 0) | 580 | if (read_pid(argv[i] + 7, &pid) == 0) |
@@ -573,6 +582,7 @@ static void run_cmd_and_exit(int i, int argc, char **argv) { | |||
573 | else | 582 | else |
574 | join_name(argv[i] + 7, argc, argv, i + 1); | 583 | join_name(argv[i] + 7, argc, argv, i + 1); |
575 | exit(0); | 584 | exit(0); |
585 | |||
576 | } | 586 | } |
577 | #ifdef HAVE_NETWORK | 587 | #ifdef HAVE_NETWORK |
578 | else if (strncmp(argv[i], "--join-network=", 15) == 0) { | 588 | else if (strncmp(argv[i], "--join-network=", 15) == 0) { |
@@ -725,13 +735,6 @@ char *guess_shell(void) { | |||
725 | i++; | 735 | i++; |
726 | } | 736 | } |
727 | 737 | ||
728 | |||
729 | // FIXME get rid of arg_csh and arg_zsh completely | ||
730 | if (strcmp(shell,"/bin/csh")) | ||
731 | arg_csh = 1; | ||
732 | if (strcmp(shell,"/usr/bin/zsh") || strcmp(shell,"/bin/zsh")) | ||
733 | arg_zsh = 1; | ||
734 | |||
735 | return shell; | 738 | return shell; |
736 | } | 739 | } |
737 | 740 | ||
@@ -1887,7 +1890,6 @@ int main(int argc, char **argv) { | |||
1887 | fprintf(stderr, "Error: only one default user shell can be specified\n"); | 1890 | fprintf(stderr, "Error: only one default user shell can be specified\n"); |
1888 | return 1; | 1891 | return 1; |
1889 | } | 1892 | } |
1890 | arg_csh = 1; | ||
1891 | cfg.shell = "/bin/csh"; | 1893 | cfg.shell = "/bin/csh"; |
1892 | } | 1894 | } |
1893 | else if (strcmp(argv[i], "--zsh") == 0) { | 1895 | else if (strcmp(argv[i], "--zsh") == 0) { |
@@ -1899,7 +1901,6 @@ int main(int argc, char **argv) { | |||
1899 | fprintf(stderr, "Error: only one default user shell can be specified\n"); | 1901 | fprintf(stderr, "Error: only one default user shell can be specified\n"); |
1900 | return 1; | 1902 | return 1; |
1901 | } | 1903 | } |
1902 | arg_zsh = 1; | ||
1903 | cfg.shell = "/bin/zsh"; | 1904 | cfg.shell = "/bin/zsh"; |
1904 | } | 1905 | } |
1905 | else if (strcmp(argv[i], "--shell=none") == 0) { | 1906 | else if (strcmp(argv[i], "--shell=none") == 0) { |