mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-10 13:00:29 +03:00
groups: Do not attempt to open /etc/groups
This commit is contained in:
parent
7fe7eab308
commit
736af8c7da
Notes:
sideshowbarker
2024-07-17 20:30:33 +09:00
Author: https://github.com/boricj Commit: https://github.com/SerenityOS/serenity/commit/736af8c7da7 Pull-request: https://github.com/SerenityOS/serenity/pull/12053 Reviewed-by: https://github.com/IdanHo
@ -31,7 +31,6 @@ static void print_account_gids(const Core::Account& account)
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
TRY(Core::System::unveil("/etc/passwd", "r"));
|
||||
TRY(Core::System::unveil("/etc/shadow", "r"));
|
||||
TRY(Core::System::unveil("/etc/group", "r"));
|
||||
TRY(Core::System::unveil(nullptr, nullptr));
|
||||
TRY(Core::System::pledge("stdio rpath", nullptr));
|
||||
@ -44,12 +43,12 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
args_parser.parse(arguments);
|
||||
|
||||
if (usernames.is_empty()) {
|
||||
auto account = TRY(Core::Account::from_uid(geteuid()));
|
||||
auto account = TRY(Core::Account::from_uid(geteuid(), Core::Account::Read::PasswdOnly));
|
||||
print_account_gids(account);
|
||||
}
|
||||
|
||||
for (auto username : usernames) {
|
||||
auto result = Core::Account::from_name(username);
|
||||
auto result = Core::Account::from_name(username, Core::Account::Read::PasswdOnly);
|
||||
if (result.is_error()) {
|
||||
warnln("{} '{}'", result.error(), username);
|
||||
continue;
|
||||
|
Loading…
Reference in New Issue
Block a user