mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:28:11 +00:00
groups: Do not attempt to open /etc/groups
This commit is contained in:
parent
7fe7eab308
commit
736af8c7da
1 changed files with 2 additions and 3 deletions
|
@ -31,7 +31,6 @@ static void print_account_gids(const Core::Account& account)
|
||||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
{
|
{
|
||||||
TRY(Core::System::unveil("/etc/passwd", "r"));
|
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("/etc/group", "r"));
|
||||||
TRY(Core::System::unveil(nullptr, nullptr));
|
TRY(Core::System::unveil(nullptr, nullptr));
|
||||||
TRY(Core::System::pledge("stdio rpath", nullptr));
|
TRY(Core::System::pledge("stdio rpath", nullptr));
|
||||||
|
@ -44,12 +43,12 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
args_parser.parse(arguments);
|
args_parser.parse(arguments);
|
||||||
|
|
||||||
if (usernames.is_empty()) {
|
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);
|
print_account_gids(account);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto username : usernames) {
|
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()) {
|
if (result.is_error()) {
|
||||||
warnln("{} '{}'", result.error(), username);
|
warnln("{} '{}'", result.error(), username);
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue