diff options
Diffstat (limited to 'src/firejail/join.c')
-rw-r--r-- | src/firejail/join.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/firejail/join.c b/src/firejail/join.c index fcc5e05d1..acd17366a 100644 --- a/src/firejail/join.c +++ b/src/firejail/join.c | |||
@@ -215,13 +215,8 @@ void join(pid_t pid, const char *homedir, int argc, char **argv, int index) { | |||
215 | // check privileges for non-root users | 215 | // check privileges for non-root users |
216 | uid_t uid = getuid(); | 216 | uid_t uid = getuid(); |
217 | if (uid != 0) { | 217 | if (uid != 0) { |
218 | struct stat s; | 218 | uid_t sandbox_uid = pid_get_uid(pid); |
219 | char *dir; | 219 | if (uid != sandbox_uid) { |
220 | if (asprintf(&dir, "/proc/%u/ns", pid) == -1) | ||
221 | errExit("asprintf"); | ||
222 | if (stat(dir, &s) < 0) | ||
223 | errExit("stat"); | ||
224 | if (s.st_uid != uid) { | ||
225 | fprintf(stderr, "Error: permission is denied to join a sandbox created by a different user.\n"); | 220 | fprintf(stderr, "Error: permission is denied to join a sandbox created by a different user.\n"); |
226 | exit(1); | 221 | exit(1); |
227 | } | 222 | } |