unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Joe Simmons-Talbott <josimmon@redhat.com>
To: Andreas Schwab <schwab@suse.de>
Cc: libc-alpha@sourceware.org, Florian Weimer <fweimer@redhat.com>,
	 Paul Eggert <eggert@cs.ucla.edu>
Subject: Re: [PATCH v12] posix: Deprecate group_member for Linux
Date: Thu, 28 Mar 2024 14:09:32 -0400	[thread overview]
Message-ID: <CAAQBMsMnGx+Qs+g=93ztk+f0pa8QM9B34+U=YPaBw34Zx5jDmg@mail.gmail.com> (raw)
In-Reply-To: <mvm7chmfk94.fsf@suse.de>

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


      reply	other threads:[~2024-03-28 18:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-28 15:09 [PATCH v12] posix: Deprecate group_member for Linux Joe Simmons-Talbott
2024-03-28 15:28 ` Andreas Schwab
2024-03-28 18:09   ` Joe Simmons-Talbott [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/libc/involved.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAAQBMsMnGx+Qs+g=93ztk+f0pa8QM9B34+U=YPaBw34Zx5jDmg@mail.gmail.com' \
    --to=josimmon@redhat.com \
    --cc=eggert@cs.ucla.edu \
    --cc=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.org \
    --cc=schwab@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).