aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/firejail/main.c60
1 files changed, 0 insertions, 60 deletions
diff --git a/src/firejail/main.c b/src/firejail/main.c
index 1ffa6158c..072651c4d 100644
--- a/src/firejail/main.c
+++ b/src/firejail/main.c
@@ -153,15 +153,6 @@ int arg_dbus_log_user = 0;
153int arg_dbus_log_system = 0; 153int arg_dbus_log_system = 0;
154int login_shell = 0; 154int login_shell = 0;
155 155
156//**********************************************************************************
157// work in progress!!!
158//**********************************************************************************
159//#define POSTMORTEM
160#ifdef POSTMORTEM
161#include <grp.h>
162pid_t pm_child = 0;
163#endif
164
165int parent_to_child_fds[2]; 156int parent_to_child_fds[2];
166int child_to_parent_fds[2]; 157int child_to_parent_fds[2];
167 158
@@ -196,19 +187,6 @@ static void my_handler(int s) {
196 fmessage("\nParent received signal %d, shutting down the child process...\n", s); 187 fmessage("\nParent received signal %d, shutting down the child process...\n", s);
197 logsignal(s); 188 logsignal(s);
198 189
199#ifdef POSTMORTEM
200printf("attempt to kill %d\n", pm_child);
201 if (pm_child) {
202 if (waitpid(pm_child, NULL, WNOHANG) == 0) {
203 if (has_handler(pm_child, s)) // signals are not delivered if there is no handler yet
204 kill(pm_child, s);
205 else
206 kill(pm_child, SIGKILL);
207 waitpid(pm_child, NULL, 0);
208 }
209 }
210#endif
211
212 if (waitpid(child, NULL, WNOHANG) == 0) { 190 if (waitpid(child, NULL, WNOHANG) == 0) {
213 if (has_handler(child, s)) // signals are not delivered if there is no handler yet 191 if (has_handler(child, s)) // signals are not delivered if there is no handler yet
214 kill(child, s); 192 kill(child, s);
@@ -3106,44 +3084,6 @@ int main(int argc, char **argv, char **envp) {
3106 } 3084 }
3107 EUID_USER(); 3085 EUID_USER();
3108 3086
3109
3110#ifdef POSTMORTEM
3111 pm_child = fork();
3112 if (pm_child == -1)
3113 fprintf(stderr, "Error: cannot start POSTMORTEM process\n");
3114 else if (pm_child == 0) {
3115 // running --join as root
3116 EUID_ROOT();
3117 int rv = setgroups(0, NULL);
3118 rv |= setuid(0);
3119 rv |= setgid(0);
3120 if (rv) {
3121 fprintf(stderr, "Error: cannot start POSTMORTEM process\n");
3122 exit(1);
3123 }
3124
3125 prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0);
3126/*problem???*/ sleep(1); // we need to give the sandbox some time to start the namespaces
3127 char *joincmd;
3128 if (asprintf(&joincmd, "--join-network=%d", child) == -1)
3129 errExit("asprintf");
3130
3131 // we join only the network ns, the filesystem is intact so we can find tcpdump
3132 char *arg[] = {
3133 "/usr/bin/firejail",
3134 joincmd,
3135 "/usr/sbin/tcpdump",
3136 "-n",
3137 "-q",
3138 NULL
3139 };
3140 execvp(arg[0], arg);
3141 assert(0);
3142printf("**********************************\n");
3143 exit(1);
3144 }
3145#endif
3146
3147 int status = 0; 3087 int status = 0;
3148 //***************************** 3088 //*****************************
3149 // following code is signal-safe 3089 // following code is signal-safe