mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 05:47:35 +00:00
Kernel+ping: Only allow superuser to create SOCK_RAW sockets
/bin/ping is now setuid-root, and will drop privileges immediately after opening a raw socket.
This commit is contained in:
parent
5c918d0e71
commit
3f254bfbc8
3 changed files with 8 additions and 0 deletions
|
@ -37,6 +37,11 @@ int main(int argc, char** argv)
|
|||
return 1;
|
||||
}
|
||||
|
||||
if (setgid(getgid()) || setuid(getuid())) {
|
||||
fprintf(stderr, "Failed to drop privileges.\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
struct timeval timeout {
|
||||
1, 0
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue