The good old "permission denied", the ignored group memberships, and a proposed solution
Henrik K
hege at hege.li
Sun May 16 19:33:44 CEST 2021
On Sun, May 16, 2021 at 07:15:38PM +0200, Luc Pardon wrote:
> 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.
There is nothing portable in executing random binaries, not everyone uses
GNU compatible OS. And some people actually post such stuff..
More information about the amavis-users
mailing list