Using getgrnam instead of getgrent.

This commit is contained in:
sergiotarxz 2021-11-13 03:53:43 +01:00
parent c05e0eb0ed
commit e16a5e52fa

View File

@ -261,15 +261,7 @@ sub new {
my $socket = $params{socket}; my $socket = $params{socket};
my ( $pid, $uid, $gid ) = unpack 'LLL', $socket->sockopt(SO_PEERCRED); my ( $pid, $uid, $gid ) = unpack 'LLL', $socket->sockopt(SO_PEERCRED);
my $user = getpwuid($uid); my $user = getpwuid($uid);
state $name = ''; my ( undef, undef, undef, $members ) = getgrnam('cualsea');
state $members = '';
if (!$name || !$members) {
while ( ( $name, undef, undef, $members ) = getgrent() ) {
if ( $name eq 'cualsea' ) {
last;
}
}
}
return any { $_ eq $user } split ' ', $members; return any { $_ eq $user } split ' ', $members;
} }
} }