From 736af8c7da7073df3fa510b04db9774aabc68956 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Boric Date: Fri, 21 Jan 2022 19:31:43 +0100 Subject: [PATCH] groups: Do not attempt to open /etc/groups --- Userland/Utilities/groups.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Userland/Utilities/groups.cpp b/Userland/Utilities/groups.cpp index 4a448ff5ac..b995726793 100644 --- a/Userland/Utilities/groups.cpp +++ b/Userland/Utilities/groups.cpp @@ -31,7 +31,6 @@ static void print_account_gids(const Core::Account& account) ErrorOr 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 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;