mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:07:45 +00:00
su: Use pledge() :^)
Not sure why we hadn't done this one sooner, seems like a high-value program to pledge.
This commit is contained in:
parent
71d23bb262
commit
2ba9e6c866
1 changed files with 10 additions and 0 deletions
|
@ -36,6 +36,11 @@ extern "C" int main(int, char**);
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
|
if (pledge("stdio rpath tty exec id", nullptr) < 0) {
|
||||||
|
perror("pledge");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (!isatty(STDIN_FILENO)) {
|
if (!isatty(STDIN_FILENO)) {
|
||||||
warnln("{}: standard in is not a terminal", argv[0]);
|
warnln("{}: standard in is not a terminal", argv[0]);
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -58,6 +63,11 @@ int main(int argc, char** argv)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pledge("stdio tty exec id", nullptr) < 0) {
|
||||||
|
perror("pledge");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
Core::Account account = account_or_error.value();
|
Core::Account account = account_or_error.value();
|
||||||
|
|
||||||
if (getuid() != 0 && account.has_password()) {
|
if (getuid() != 0 && account.has_password()) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue