diff options
Diffstat (limited to 'src/firejail/list.c')
-rw-r--r-- | src/firejail/list.c | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/src/firejail/list.c b/src/firejail/list.c deleted file mode 100644 index cd53264b6..000000000 --- a/src/firejail/list.c +++ /dev/null | |||
@@ -1,81 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2014-2016 Firejail Authors | ||
3 | * | ||
4 | * This file is part of firejail project | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License along | ||
17 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
19 | */ | ||
20 | #include "firejail.h" | ||
21 | #include <sys/types.h> | ||
22 | #include <sys/stat.h> | ||
23 | |||
24 | static void grsec_elevate_privileges(void) { | ||
25 | struct stat s; | ||
26 | if (stat("/proc/sys/kernel/grsecurity", &s) == 0) { | ||
27 | EUID_ROOT(); | ||
28 | |||
29 | // elevate privileges | ||
30 | if (setreuid(0, 0)) | ||
31 | errExit("setreuid"); | ||
32 | if (setregid(0, 0)) | ||
33 | errExit("setregid"); | ||
34 | } | ||
35 | } | ||
36 | |||
37 | void top(void) { | ||
38 | EUID_ASSERT(); | ||
39 | |||
40 | char *arg[4]; | ||
41 | arg[0] = "bash"; | ||
42 | arg[1] = "-c"; | ||
43 | arg[2] = "firemon --top"; | ||
44 | arg[3] = NULL; | ||
45 | execvp("/bin/bash", arg); | ||
46 | } | ||
47 | |||
48 | void netstats(void) { | ||
49 | EUID_ASSERT(); | ||
50 | grsec_elevate_privileges(); | ||
51 | |||
52 | char *arg[4]; | ||
53 | arg[0] = "bash"; | ||
54 | arg[1] = "-c"; | ||
55 | arg[2] = "firemon --netstats"; | ||
56 | arg[3] = NULL; | ||
57 | execvp("/bin/bash", arg); | ||
58 | } | ||
59 | |||
60 | void list(void) { | ||
61 | EUID_ASSERT(); | ||
62 | |||
63 | char *arg[4]; | ||
64 | arg[0] = "bash"; | ||
65 | arg[1] = "-c"; | ||
66 | arg[2] = "firemon --list"; | ||
67 | arg[3] = NULL; | ||
68 | execvp("/bin/bash", arg); | ||
69 | } | ||
70 | |||
71 | void tree(void) { | ||
72 | EUID_ASSERT(); | ||
73 | |||
74 | char *arg[4]; | ||
75 | arg[0] = "bash"; | ||
76 | arg[1] = "-c"; | ||
77 | arg[2] = "firemon --tree"; | ||
78 | arg[3] = NULL; | ||
79 | execvp("/bin/bash", arg); | ||
80 | } | ||
81 | |||