From c351e194f9db2b79bdb0d2de8e1001ec3c819010 Mon Sep 17 00:00:00 2001 From: Peter Millerchip Date: Tue, 18 Aug 2015 09:56:44 +0100 Subject: Support ~ in blacklist and profile includes --- src/firejail/fs.c | 5 +++++ src/firejail/profile.c | 4 ++++ todo | 5 +---- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/firejail/fs.c b/src/firejail/fs.c index 4b4e63288..38946c8d9 100644 --- a/src/firejail/fs.c +++ b/src/firejail/fs.c @@ -297,6 +297,11 @@ void fs_blacklist(const char *homedir) { errExit("asprintf"); ptr = new_name; } + else if (strncmp(ptr, "~/", 2) == 0) { + if (asprintf(&new_name, "%s%s", homedir, ptr + 1) == -1) + errExit("asprintf"); + ptr = new_name; + } // expand path macro - look for the file in /bin, /usr/bin, /sbin and /usr/sbin directories if (strncmp(ptr, "${PATH}", 7) == 0) { diff --git a/src/firejail/profile.c b/src/firejail/profile.c index a73582499..4aac2bdb4 100644 --- a/src/firejail/profile.c +++ b/src/firejail/profile.c @@ -430,6 +430,10 @@ void profile_read(const char *fname, const char *skip1, const char *skip2) { if (asprintf(&newprofile2, "%s%s", cfg.homedir, newprofile + 7) == -1) errExit("asprintf"); } + else if (strncmp(newprofile, "~/", 2) == 0) { + if (asprintf(&newprofile2, "%s%s", cfg.homedir, newprofile + 1) == -1) + errExit("asprintf"); + } // recursivity profile_read((newprofile2)? newprofile2:newprofile, newskip1, newskip2); diff --git a/todo b/todo index aa4c0968c..40dc92d6f 100644 --- a/todo +++ b/todo @@ -1,6 +1,3 @@ 1. Deal with .purple directory. It holds the confiig files for pidgin -2. Support ~ in --blacklist filenames, maybe in some other options. Example -$ firejail --blacklist=~/.ssh - -3. Support filenames with spaces in blacklist option. +2. Support filenames with spaces in blacklist option. -- cgit v1.2.3-54-g00ecf