diff options
author | 2021-11-29 17:11:25 -0500 | |
---|---|---|
committer | 2021-11-29 17:11:25 -0500 | |
commit | a63643a5b65463553dcb5f2dd4e911bd5a22be6b (patch) | |
tree | fee1dfd60d583075c974f12c9caabcdff007e76c /src | |
parent | disable shell tab completion for --whitelist and --private commands (diff) | |
download | firejail-a63643a5b65463553dcb5f2dd4e911bd5a22be6b.tar.gz firejail-a63643a5b65463553dcb5f2dd4e911bd5a22be6b.tar.zst firejail-a63643a5b65463553dcb5f2dd4e911bd5a22be6b.zip |
fix: allow tilde (home directory) in --netfilter file name
Diffstat (limited to 'src')
-rw-r--r-- | src/firejail/main.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/firejail/main.c b/src/firejail/main.c index b4117bb70..af2c603df 100644 --- a/src/firejail/main.c +++ b/src/firejail/main.c | |||
@@ -2661,6 +2661,15 @@ int main(int argc, char **argv, char **envp) { | |||
2661 | if (checkcfg(CFG_NETWORK)) { | 2661 | if (checkcfg(CFG_NETWORK)) { |
2662 | arg_netfilter = 1; | 2662 | arg_netfilter = 1; |
2663 | arg_netfilter_file = argv[i] + 12; | 2663 | arg_netfilter_file = argv[i] + 12; |
2664 | |||
2665 | // expand tilde | ||
2666 | if (*arg_netfilter_file == '~') { | ||
2667 | char *tmp; | ||
2668 | if (asprintf(&tmp, "%s%s", cfg.homedir, arg_netfilter_file + 1) == -1) | ||
2669 | errExit("asprintf"); | ||
2670 | arg_netfilter_file = tmp; | ||
2671 | } | ||
2672 | |||
2664 | check_netfilter_file(arg_netfilter_file); | 2673 | check_netfilter_file(arg_netfilter_file); |
2665 | } | 2674 | } |
2666 | else | 2675 | else |
@@ -2671,6 +2680,15 @@ int main(int argc, char **argv, char **envp) { | |||
2671 | if (checkcfg(CFG_NETWORK)) { | 2680 | if (checkcfg(CFG_NETWORK)) { |
2672 | arg_netfilter6 = 1; | 2681 | arg_netfilter6 = 1; |
2673 | arg_netfilter6_file = argv[i] + 13; | 2682 | arg_netfilter6_file = argv[i] + 13; |
2683 | |||
2684 | // expand tilde | ||
2685 | if (*arg_netfilter6_file == '~') { | ||
2686 | char *tmp; | ||
2687 | if (asprintf(&tmp, "%s%s", cfg.homedir, arg_netfilter6_file + 1) == -1) | ||
2688 | errExit("asprintf"); | ||
2689 | arg_netfilter6_file = tmp; | ||
2690 | } | ||
2691 | |||
2674 | check_netfilter_file(arg_netfilter6_file); | 2692 | check_netfilter_file(arg_netfilter6_file); |
2675 | } | 2693 | } |
2676 | else | 2694 | else |