mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 17:07:46 +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:
parent
02406b7305
commit
cec0268ffa
1 changed files with 15 additions and 0 deletions
|
@ -40,6 +40,21 @@ static bool flag_print_gid_all = false;
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
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) {
|
if (pledge("stdio rpath", nullptr) < 0) {
|
||||||
perror("pledge");
|
perror("pledge");
|
||||||
return 1;
|
return 1;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue