aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar rusty-snake <41237666+rusty-snake@users.noreply.github.com>2020-09-11 10:07:05 +0000
committerLibravatar GitHub <noreply@github.com>2020-09-11 10:07:05 +0000
commit449df86f183fc9d5bb2a6482fb1fb5f6053dbd57 (patch)
tree1caf30931b8755295fa0dc781f10ada5d5f33f0a
parentreadme update (diff)
downloadfirejail-449df86f183fc9d5bb2a6482fb1fb5f6053dbd57.tar.gz
firejail-449df86f183fc9d5bb2a6482fb1fb5f6053dbd57.tar.zst
firejail-449df86f183fc9d5bb2a6482fb1fb5f6053dbd57.zip
add --include (#3571)
* add --include closes #2923 * Priorize searching in cwd
-rw-r--r--src/firejail/main.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/firejail/main.c b/src/firejail/main.c
index 790b0731c..841aa47a7 100644
--- a/src/firejail/main.c
+++ b/src/firejail/main.c
@@ -1709,6 +1709,34 @@ int main(int argc, char **argv, char **envp) {
1709 } 1709 }
1710 } 1710 }
1711#endif 1711#endif
1712 else if (strncmp(argv[i], "--include=", 10) == 0) {
1713 char *ppath = expand_macros(argv[i] + 10);
1714 if (!ppath)
1715 errExit("strdup");
1716
1717 char *ptr = ppath;
1718 while (*ptr != '/' && *ptr != '\0')
1719 ptr++;
1720 if (*ptr == '\0') {
1721 if (access(ppath, R_OK)) {
1722 profile_read(ppath);
1723 }
1724 else {
1725 // ppath contains no '/' and is not a local file, assume it's a name
1726 int rv = profile_find_firejail(ppath, 0);
1727 if (!rv) {
1728 fprintf(stderr, "Error: no profile with name \"%s\" found.\n", ppath);
1729 exit(1);
1730 }
1731 }
1732 }
1733 else {
1734 // ppath contains a '/', assume it's a path
1735 profile_read(ppath);
1736 }
1737
1738 free(ppath);
1739 }
1712 else if (strncmp(argv[i], "--profile=", 10) == 0) { 1740 else if (strncmp(argv[i], "--profile=", 10) == 0) {
1713 // multiple profile files are allowed! 1741 // multiple profile files are allowed!
1714 1742