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

Luc Pardon amavisuser at skopos.be
Sun May 16 19:15:38 CEST 2021


On Sun, 16 May 2021 18:57:49 +0300
Henrik K <hege at hege.li> 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.




More information about the amavis-users mailing list