Add sanity check

As a sanity check whether we're able to regain root after dropping
it. If we are able to, then something went wrong.
This commit is contained in:
madmaurice 2021-01-15 20:22:22 +01:00
parent 650a576c56
commit 6bd03ad564

6
main.c
View file

@ -29,6 +29,12 @@ void drop_root(void) {
printf("Failed to drop root privileges with setegid (%d)\n", err); printf("Failed to drop root privileges with setegid (%d)\n", err);
exit(err); exit(err);
} }
// sanity check
if(seteuid(0) != -1) {
printf("Sanity check failed. I was able to regain root.\n");
exit(1);
}
} }
void forward_signal(int sig) void forward_signal(int sig)