diff options
-rw-r--r-- | src/firejail/checkcfg.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/firejail/checkcfg.c b/src/firejail/checkcfg.c index 6929988ae..7de491f5f 100644 --- a/src/firejail/checkcfg.c +++ b/src/firejail/checkcfg.c | |||
@@ -58,6 +58,15 @@ int checkcfg(int val) { | |||
58 | #endif | 58 | #endif |
59 | } | 59 | } |
60 | 60 | ||
61 | // if the file exists, it should be owned by root | ||
62 | struct stat s; | ||
63 | if (stat(fname, &s) == -1) | ||
64 | errExit("stat"); | ||
65 | if (s.st_uid != 0 || s.st_gid != 0) { | ||
66 | fprintf(stderr, "Error: configuration file should be owned by root\n"); | ||
67 | exit(1); | ||
68 | } | ||
69 | |||
61 | // read configuration file | 70 | // read configuration file |
62 | char buf[MAX_READ]; | 71 | char buf[MAX_READ]; |
63 | while (fgets(buf,MAX_READ, fp)) { | 72 | while (fgets(buf,MAX_READ, fp)) { |