From 076b17788be2c1f1138e6bc1301049b8d8b72c37 Mon Sep 17 00:00:00 2001 From: netblue30 Date: Wed, 25 Nov 2015 10:33:04 -0500 Subject: --debug enhancements --- src/firejail/firejail.h | 1 + src/firejail/main.c | 5 +++++ src/firejail/util.c | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/firejail/firejail.h b/src/firejail/firejail.h index a364de75f..e4e6f4fa4 100644 --- a/src/firejail/firejail.h +++ b/src/firejail/firejail.h @@ -186,6 +186,7 @@ static inline int any_interface_configured(void) { extern int arg_private; // mount private /home extern int arg_debug; // print debug messages +extern int arg_debug_check_filename; // print debug messages for invalid_filename() extern int arg_nonetwork; // --net=none extern int arg_command; // -c extern int arg_overlay; // overlay option diff --git a/src/firejail/main.c b/src/firejail/main.c index 891653587..02eab1a86 100644 --- a/src/firejail/main.c +++ b/src/firejail/main.c @@ -50,6 +50,7 @@ static char child_stack[STACK_SIZE]; // space for child's stack Config cfg; // configuration int arg_private = 0; // mount private /home and /tmp directoryu int arg_debug = 0; // print debug messages +int arg_debug_check_filename; // print debug messages for invalid_filename() int arg_nonetwork = 0; // --net=none int arg_command = 0; // -c int arg_overlay = 0; // overlay option @@ -457,6 +458,10 @@ int main(int argc, char **argv) { if (strcmp(argv[i], "--debug") == 0) arg_debug = 1; + else if (strcmp(argv[i], "--debug-check-filename") == 0) { + arg_debug = 1; + arg_debug_check_filename = 1; + } else if (strcmp(argv[i], "--quiet") == 0) arg_quiet = 1; diff --git a/src/firejail/util.c b/src/firejail/util.c index 880e45465..0d9479a02 100644 --- a/src/firejail/util.c +++ b/src/firejail/util.c @@ -574,7 +574,7 @@ void invalid_filename(const char *fname) { assert(fname); const char *ptr = fname; - if (arg_debug) + if (arg_debug && arg_debug_check_filename) printf("Checking filename %s\n", fname); if (strncmp(ptr, "${HOME}", 7) == 0) -- cgit v1.2.3-54-g00ecf