unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@suse.de>
To: Joe Simmons-Talbott <josimmon@redhat.com>
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 16:28:55 +0100	[thread overview]
Message-ID: <mvm7chmfk94.fsf@suse.de> (raw)
In-Reply-To: <20240328150911.2391597-1-josimmon@redhat.com> (Joe Simmons-Talbott's message of "Thu, 28 Mar 2024 11:09:07 -0400")

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.

-- 
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."

  reply	other threads:[~2024-03-28 15:29 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 [this message]
2024-03-28 18:09   ` Joe Simmons-Talbott

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=mvm7chmfk94.fsf@suse.de \
    --to=schwab@suse.de \
    --cc=eggert@cs.ucla.edu \
    --cc=fweimer@redhat.com \
    --cc=josimmon@redhat.com \
    --cc=libc-alpha@sourceware.org \
    /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).