1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 20:37:34 +00:00

id: Use unveil()

And so "id" becomes our first user of unveil(), giving himself access
to read /etc/passwd and /etc/group :^)
This commit is contained in:
Andreas Kling 2020-01-20 22:21:41 +01:00
parent 02406b7305
commit cec0268ffa

View file

@ -40,6 +40,21 @@ static bool flag_print_gid_all = false;
int main(int argc, char** argv)
{
if (unveil("/etc/passwd", "r") < 0) {
perror("unveil");
return 1;
}
if (unveil("/etc/group", "r") < 0) {
perror("unveil");
return 1;
}
if (unveil(nullptr, nullptr) < 0) {
perror("unveil");
return 1;
}
if (pledge("stdio rpath", nullptr) < 0) {
perror("pledge");
return 1;