From 9a430b94d8e2b5ec4b8027a62072bc9d02136128 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20Marussy?= Date: Sat, 9 May 2020 01:55:11 +0200 Subject: [PATCH] Turn attempted DBus policy downgrade into warning (fixes #3408) --- src/firejail/main.c | 12 ++++++------ src/firejail/profile.c | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/firejail/main.c b/src/firejail/main.c index e458d16f483..958374c4339 100644 --- a/src/firejail/main.c +++ b/src/firejail/main.c @@ -2065,10 +2065,10 @@ int main(int argc, char **argv, char **envp) { else if (strncmp("--dbus-user=", argv[i], 12) == 0) { if (strcmp("filter", argv[i] + 12) == 0) { if (arg_dbus_user == DBUS_POLICY_BLOCK) { - fprintf(stderr, "Error: Cannot relax --dbus-user policy, it is already set to block\n"); - exit(1); + fprintf(stderr, "Warning: Cannot relax --dbus-user policy, it is already set to block\n"); + } else { + arg_dbus_user = DBUS_POLICY_FILTER; } - arg_dbus_user = DBUS_POLICY_FILTER; } else if (strcmp("none", argv[i] + 12) == 0) { if (arg_dbus_log_user) { fprintf(stderr, "Error: --dbus-user.log requires --dbus-user=filter\n"); @@ -2123,10 +2123,10 @@ int main(int argc, char **argv, char **envp) { else if (strncmp("--dbus-system=", argv[i], 14) == 0) { if (strcmp("filter", argv[i] + 14) == 0) { if (arg_dbus_system == DBUS_POLICY_BLOCK) { - fprintf(stderr, "Error: Cannot relax --dbus-system policy, it is already set to block\n"); - exit(1); + fprintf(stderr, "Warning: Cannot relax --dbus-system policy, it is already set to block\n"); + } else { + arg_dbus_system = DBUS_POLICY_FILTER; } - arg_dbus_system = DBUS_POLICY_FILTER; } else if (strcmp("none", argv[i] + 14) == 0) { if (arg_dbus_log_system) { fprintf(stderr, "Error: --dbus-system.log requires --dbus-system=filter\n"); diff --git a/src/firejail/profile.c b/src/firejail/profile.c index 74900648793..a872228242a 100644 --- a/src/firejail/profile.c +++ b/src/firejail/profile.c @@ -441,9 +441,9 @@ int profile_check_line(char *ptr, int lineno, const char *fname) { if (strcmp("filter", ptr) == 0) { if (arg_dbus_user == DBUS_POLICY_BLOCK) { fprintf(stderr, "Error: Cannot relax dbus-user policy, it is already set to block\n"); - exit(1); + } else { + arg_dbus_user = DBUS_POLICY_FILTER; } - arg_dbus_user = DBUS_POLICY_FILTER; } else if (strcmp("none", ptr) == 0) { if (arg_dbus_log_user) { fprintf(stderr, "Error: --dbus-user.log requires --dbus-user=filter\n"); @@ -496,9 +496,9 @@ int profile_check_line(char *ptr, int lineno, const char *fname) { if (strcmp("filter", ptr) == 0) { if (arg_dbus_system == DBUS_POLICY_BLOCK) { fprintf(stderr, "Error: Cannot relax dbus-system policy, it is already set to block\n"); - exit(1); + } else { + arg_dbus_system = DBUS_POLICY_FILTER; } - arg_dbus_system = DBUS_POLICY_FILTER; } else if (strcmp("none", ptr) == 0) { if (arg_dbus_log_system) { fprintf(stderr, "Error: --dbus-system.log requires --dbus-system=filter\n");