mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-24 18:32:28 -05: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)
|
||||
{
|
||||
if (pledge("stdio rpath tty exec id", nullptr) < 0) {
|
||||
perror("pledge");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!isatty(STDIN_FILENO)) {
|
||||
warnln("{}: standard in is not a terminal", argv[0]);
|
||||
return 1;
|
||||
|
@ -58,6 +63,11 @@ int main(int argc, char** argv)
|
|||
return 1;
|
||||
}
|
||||
|
||||
if (pledge("stdio tty exec id", nullptr) < 0) {
|
||||
perror("pledge");
|
||||
return 1;
|
||||
}
|
||||
|
||||
Core::Account account = account_or_error.value();
|
||||
|
||||
if (getuid() != 0 && account.has_password()) {
|
||||
|
|
Loading…
Add table
Reference in a new issue