Re: The good old "permission denied", the ignored group memberships, and a proposed solution

Luc Pardon <[email protected]>
Newsgroups gmane.mail.virus.amavis.user
Message-ID <[email protected]>
On Sun, 16 May 2021 18:57:49 +0300
Henrik K <[email protected]> wrote:

> Well, old lazy code is also a bad thing.  I already noticed there's
> suspect matching, $members =~ /\b$user\b/ might falsely match group
> names containing underscores (it's a word boundary..).  Fixed it to
> be more strict..
> 

How about this as a one-line replacement for get_user_groups() in SA ?

   my $gids = qx/id -G $desired_user/;

The /usr/bin/id utility is part of GNU coreutils, so it's probably safe
to take it for granted "if not (RUNNING_ON_WINDOWS)". 

The idea is not mine, I came across it when searching for a portable
way to "get user groups" in a bash shell script. If you want, I could
try and locate the source. I seem to recall there was a discussion
about group names with blanks and underscores and what have you.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.