diff options
author | smitsohu <smitsohu@gmail.com> | 2018-08-20 23:34:28 +0200 |
---|---|---|
committer | smitsohu <smitsohu@gmail.com> | 2018-08-20 23:34:28 +0200 |
commit | ec7f59b8d370c29bd229fa9124640611c0667159 (patch) | |
tree | 30b12ce89fd04343aa5cbf5b5254ce63cb8af9fc /src/firejail/fs_logger.c | |
parent | Document how to access local mail with thunderbird and claws-mail (fixes #1509) (diff) | |
download | firejail-ec7f59b8d370c29bd229fa9124640611c0667159.tar.gz firejail-ec7f59b8d370c29bd229fa9124640611c0667159.tar.zst firejail-ec7f59b8d370c29bd229fa9124640611c0667159.zip |
refactor, check the sandbox status for all join options
Diffstat (limited to 'src/firejail/fs_logger.c')
-rw-r--r-- | src/firejail/fs_logger.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/src/firejail/fs_logger.c b/src/firejail/fs_logger.c index 93f28a26b..bf3ac26be 100644 --- a/src/firejail/fs_logger.c +++ b/src/firejail/fs_logger.c | |||
@@ -120,18 +120,13 @@ void fs_logger_change_owner(void) { | |||
120 | void fs_logger_print_log(pid_t pid) { | 120 | void fs_logger_print_log(pid_t pid) { |
121 | EUID_ASSERT(); | 121 | EUID_ASSERT(); |
122 | 122 | ||
123 | // if the pid is that of a firejail process, use the pid of the first child process | 123 | // in case the pid is that of a firejail process, use the pid of the first child process |
124 | EUID_ROOT(); | 124 | pid = switch_to_child(pid); |
125 | char *comm = pid_proc_comm(pid); | 125 | |
126 | EUID_USER(); | 126 | // now check if the pid belongs to a firejail sandbox |
127 | if (comm) { | 127 | if (invalid_sandbox(pid)) { |
128 | if (strcmp(comm, "firejail") == 0) { | 128 | fprintf(stderr, "Error: no valid sandbox\n"); |
129 | pid_t child; | 129 | exit(1); |
130 | if (find_child(pid, &child) == 0) { | ||
131 | pid = child; | ||
132 | } | ||
133 | } | ||
134 | free(comm); | ||
135 | } | 130 | } |
136 | 131 | ||
137 | // check privileges for non-root users | 132 | // check privileges for non-root users |