[PATCH v12] posix: Deprecate group_member for Linux

Joe Simmons-Talbott josimmon@redhat.com
Thu Mar 28 18:09:32 GMT 2024


On Thu, Mar 28, 2024 at 11:36 AM Andreas Schwab <schwab@suse.de> wrote:
>
> On Mär 28 2024, Joe Simmons-Talbott wrote:
>
> > diff --git a/sysdeps/posix/euidaccess.c b/sysdeps/posix/euidaccess.c
> > index 4c5c2220bd..0c19021a30 100644
> > --- a/sysdeps/posix/euidaccess.c
> > +++ b/sysdeps/posix/euidaccess.c
> > @@ -81,7 +81,7 @@ extern int errno;
> >
> >  #ifdef _LIBC
> >
> > -# define group_member __group_member
> > +# define group_member __group_member2
> >  # define euidaccess __euidaccess
> >
> >  #else
> > @@ -167,9 +167,14 @@ euidaccess (const char *path, int mode)
> >                   || (stats.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))))
> >      return 0;
> >
> > +  int gm = group_member (stats.st_gid);
> > +  if (euid != stats.st_uid && egid != stats.st_gid)
> > +    if (gm == -1)
> > +      return -1;
> > +
>
> I think this should only call group_member if needed, ie if neither euid
> nor egid match.  In the _LIBC case, this could return spurious errors,
> otherwise.
>
> Also, gm should be named something like is_group_member.
>

Thanks for the review.  I've posted a v13 patch [1] with the changes
you suggested and updated faccessat to use a more descriptive
temporary variable name.

Thanks,
Joe

[1] https://sourceware.org/pipermail/libc-alpha/2024-March/155671.html
> --
> Andreas Schwab, SUSE Labs, schwab@suse.de
> GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
> "And now for something completely different."
>


-- 
Joe Simmons-Talbott



More information about the Libc-alpha mailing list