diff options
author | 2016-02-19 14:57:58 -0500 | |
---|---|---|
committer | 2016-02-19 14:57:58 -0500 | |
commit | 02a66f7e4086097a98dfdac0b47c9909908360a0 (patch) | |
tree | 443fb269e84c89842965677386260e71b85de227 /src/firejail/shutdown.c | |
parent | moved sandbox name to /run/firejail/name/<PID> (diff) | |
download | firejail-02a66f7e4086097a98dfdac0b47c9909908360a0.tar.gz firejail-02a66f7e4086097a98dfdac0b47c9909908360a0.tar.zst firejail-02a66f7e4086097a98dfdac0b47c9909908360a0.zip |
euid switching
Diffstat (limited to 'src/firejail/shutdown.c')
-rw-r--r-- | src/firejail/shutdown.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/firejail/shutdown.c b/src/firejail/shutdown.c index edaac7eb9..c88683aaa 100644 --- a/src/firejail/shutdown.c +++ b/src/firejail/shutdown.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <sys/prctl.h> | 24 | #include <sys/prctl.h> |
25 | 25 | ||
26 | void shut_name(const char *name) { | 26 | void shut_name(const char *name) { |
27 | EUID_ASSERT(); | ||
27 | if (!name || strlen(name) == 0) { | 28 | if (!name || strlen(name) == 0) { |
28 | fprintf(stderr, "Error: invalid sandbox name\n"); | 29 | fprintf(stderr, "Error: invalid sandbox name\n"); |
29 | exit(1); | 30 | exit(1); |
@@ -39,6 +40,8 @@ void shut_name(const char *name) { | |||
39 | } | 40 | } |
40 | 41 | ||
41 | void shut(pid_t pid) { | 42 | void shut(pid_t pid) { |
43 | EUID_ASSERT(); | ||
44 | |||
42 | pid_t parent = pid; | 45 | pid_t parent = pid; |
43 | // if the pid is that of a firejail process, use the pid of a child process inside the sandbox | 46 | // if the pid is that of a firejail process, use the pid of a child process inside the sandbox |
44 | char *comm = pid_proc_comm(pid); | 47 | char *comm = pid_proc_comm(pid); |
@@ -73,6 +76,7 @@ void shut(pid_t pid) { | |||
73 | } | 76 | } |
74 | } | 77 | } |
75 | 78 | ||
79 | EUID_ROOT(); | ||
76 | printf("Sending SIGTERM to %u\n", pid); | 80 | printf("Sending SIGTERM to %u\n", pid); |
77 | kill(pid, SIGTERM); | 81 | kill(pid, SIGTERM); |
78 | sleep(2); | 82 | sleep(2); |