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:
parent
650a576c56
commit
6bd03ad564
1 changed files with 6 additions and 0 deletions
6
main.c
6
main.c
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue