diff options
Diffstat (limited to 'src/firejail/main.c')
-rw-r--r-- | src/firejail/main.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/firejail/main.c b/src/firejail/main.c index 5cc2d4123..daa924698 100644 --- a/src/firejail/main.c +++ b/src/firejail/main.c | |||
@@ -888,19 +888,20 @@ char *guess_shell(void) { | |||
888 | return shell; | 888 | return shell; |
889 | } | 889 | } |
890 | 890 | ||
891 | // return argument index | ||
891 | static int check_arg(int argc, char **argv, const char *argument, int strict) { | 892 | static int check_arg(int argc, char **argv, const char *argument, int strict) { |
892 | int i; | 893 | int i; |
893 | int found = 0; | 894 | int found = 0; |
894 | for (i = 1; i < argc; i++) { | 895 | for (i = 1; i < argc; i++) { |
895 | if (strict) { | 896 | if (strict) { |
896 | if (strcmp(argv[i], argument) == 0) { | 897 | if (strcmp(argv[i], argument) == 0) { |
897 | found = 1; | 898 | found = i; |
898 | break; | 899 | break; |
899 | } | 900 | } |
900 | } | 901 | } |
901 | else { | 902 | else { |
902 | if (strncmp(argv[i], argument, strlen(argument)) == 0) { | 903 | if (strncmp(argv[i], argument, strlen(argument)) == 0) { |
903 | found = 1; | 904 | found = i; |
904 | break; | 905 | break; |
905 | } | 906 | } |
906 | } | 907 | } |
@@ -1046,6 +1047,14 @@ int main(int argc, char **argv, char **envp) { | |||
1046 | } | 1047 | } |
1047 | EUID_USER(); | 1048 | EUID_USER(); |
1048 | 1049 | ||
1050 | // --ip=dhcp - we need access to /sbin and /usr/sbin directories in order to run ISC DHCP client (dhclient) | ||
1051 | // these paths are disabled in disable-common.inc | ||
1052 | if ((i = check_arg(argc, argv, "--ip", 0)) != 0) { | ||
1053 | if (strncmp(argv[i] + 4, "=dhcp", 5) == 0) { | ||
1054 | profile_add("noblacklist /sbin"); | ||
1055 | profile_add("noblacklist /usr/sbin"); | ||
1056 | } | ||
1057 | } | ||
1049 | 1058 | ||
1050 | // for appimages we need to remove "include disable-shell.inc from the profile | 1059 | // for appimages we need to remove "include disable-shell.inc from the profile |
1051 | // a --profile command can show up before --appimage | 1060 | // a --profile command can show up before --appimage |