diff options
author | netblue30 <netblue30@yahoo.com> | 2018-11-08 10:49:44 -0500 |
---|---|---|
committer | netblue30 <netblue30@yahoo.com> | 2018-11-08 10:49:44 -0500 |
commit | 2acc910daf73c284965ca96bc70b4eb980c865cf (patch) | |
tree | 7b5733a8ccacba4089a7a9c067b12355372c8dc9 /src | |
parent | Merge pull request #2251 from glitsj16/sort (diff) | |
download | firejail-2acc910daf73c284965ca96bc70b4eb980c865cf.tar.gz firejail-2acc910daf73c284965ca96bc70b4eb980c865cf.tar.zst firejail-2acc910daf73c284965ca96bc70b4eb980c865cf.zip |
profile parser testing
Diffstat (limited to 'src')
-rw-r--r-- | src/firejail/firejail.h | 3 | ||||
-rw-r--r-- | src/firejail/profile.c | 12 |
2 files changed, 11 insertions, 4 deletions
diff --git a/src/firejail/firejail.h b/src/firejail/firejail.h index d996e1dac..46aea4bd4 100644 --- a/src/firejail/firejail.h +++ b/src/firejail/firejail.h | |||
@@ -461,8 +461,7 @@ void fs_mnt(const int enforce); | |||
461 | 461 | ||
462 | // profile.c | 462 | // profile.c |
463 | // find and read the profile specified by name from dir directory | 463 | // find and read the profile specified by name from dir directory |
464 | int profile_find(const char *name, const char *dir, int add_ext); | 464 | //int profile_find_firejail(const char *name, int add_ext); |
465 | int profile_find_firejail(const char *name, int add_ext); | ||
466 | // read a profile file | 465 | // read a profile file |
467 | void profile_read(const char *fname); | 466 | void profile_read(const char *fname); |
468 | // check profile line; if line == 0, this was generated from a command line option | 467 | // check profile line; if line == 0, this was generated from a command line option |
diff --git a/src/firejail/profile.c b/src/firejail/profile.c index a85c8f815..5f5d94ddf 100644 --- a/src/firejail/profile.c +++ b/src/firejail/profile.c | |||
@@ -25,7 +25,8 @@ extern char *xephyr_screen; | |||
25 | #define MAX_READ 8192 // line buffer for profile files | 25 | #define MAX_READ 8192 // line buffer for profile files |
26 | 26 | ||
27 | // find and read the profile specified by name from dir directory | 27 | // find and read the profile specified by name from dir directory |
28 | int profile_find(const char *name, const char *dir, int add_ext) { | 28 | // return 1 if a profile was found |
29 | static int profile_find(const char *name, const char *dir, int add_ext) { | ||
29 | EUID_ASSERT(); | 30 | EUID_ASSERT(); |
30 | assert(name); | 31 | assert(name); |
31 | assert(dir); | 32 | assert(dir); |
@@ -64,6 +65,7 @@ int profile_find(const char *name, const char *dir, int add_ext) { | |||
64 | } | 65 | } |
65 | 66 | ||
66 | // search and read the profile specified by name from firejail directories | 67 | // search and read the profile specified by name from firejail directories |
68 | // return 1 if a profile was found | ||
67 | int profile_find_firejail(const char *name, int add_ext) { | 69 | int profile_find_firejail(const char *name, int add_ext) { |
68 | // look for a profile in ~/.config/firejail directory | 70 | // look for a profile in ~/.config/firejail directory |
69 | char *usercfgdir; | 71 | char *usercfgdir; |
@@ -1438,7 +1440,13 @@ void profile_read(const char *fname) { | |||
1438 | ptr2++; | 1440 | ptr2++; |
1439 | // profile path contains no / chars, do a search | 1441 | // profile path contains no / chars, do a search |
1440 | if (*ptr2 == '\0') { | 1442 | if (*ptr2 == '\0') { |
1441 | profile_find_firejail(newprofile, 0); | 1443 | int rv = profile_find_firejail(newprofile, 0); // returns 1 if a profile was found in sysconfig directory |
1444 | if (!rv) { | ||
1445 | // maybe this is a file in the local working directory? | ||
1446 | // it will stop the sandbox if not! | ||
1447 | // Note: if the file ends in .local it will not stop the program | ||
1448 | profile_read(newprofile); | ||
1449 | } | ||
1442 | } | 1450 | } |
1443 | else { | 1451 | else { |
1444 | profile_read(newprofile); | 1452 | profile_read(newprofile); |