From f166d8653042df4b840c4d56fba752e266c8bffb Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sun, 9 Mar 1997 06:16:49 +0000 Subject: Update. 1997-03-09 06:59 Ulrich Drepper * Makeconfig: Add ASFLAGS-% flags for SPARC assembler which need -fPIC. * Makerules (compile.S): Use ASFLAGS-%. (COMPILE.S): Likewise. * config.make.in (ASFLAGS-.so): Define from ASFLAGS_SO. * configure.in: Substitute ASFLAGS_SO. * sysdeps/sparc/configure.in: New file. * posix/unitstd.h: Add prototype for __euidaccess. * sysdeps/posix/euidaccess.c: Define as __euidaccess and make euidaccess weak alias. * sysdeps/stubs/euidaccess.c: Likewise. * inet/rcmd.c: Use __ protected versions of non-standard functions. * locale/setlocale.c (setlocale): Don't set usage_count to MAX_USAGE_COUNT if it already has this value. * locale/programs/localedef.c: Don't use LOCALE_PATH to find binary locale files. Use LOCALEDIR only. * locale/programs/locfile.c: When named file not found and not absolute use path in I18NPATH. * stdlib/Makefile (headers): Add inttypes.h. * sysdpes/generic/socketbits.h: Add PF_FILE as synonym for PF_LOCAL and AF_FILE as synonym for AF_LOCAL. * sysdpes/unix/sysv/linux/socketbits.h: Likewise. * time/Makefile: Rewrite rules for test to handle parallel builds. 1997-03-09 05:26 Ulrich Drepper * manual/startup.texi (EXIT_FAILURE): Fix typo. Patch by robbe@orcus.priv.at. 1997-03-09 05:10 Edward Seidl * sysdeps/i386/elf/start.S (nofini): *Really* align stack to 8-byte boundary. 1997-03-09 01:48 Ulrich Drepper * elf/link.h: Define __need_NULL to get definition. Include . Patch by Andreas Jaeger . 1997-03-08 21:48 Thorsten Kukuk Rewrite NIS code to allow empty keys. * nis/nss_nis/nis-ethers.c: Rewritten. * nis/nss_nis/nis-proto.c: Rewritten. * nis/nss_nis/nis-publickey.c: Rewritten. * nis/nss_nis/nis-rpc.c: Rewritten. * nis/nss_nis/nis-service.c: Rewritten. 1997-03-08 16:02 Andreas Jaeger * time/scheck.c (scheck): Add extra const to second argument. * time/private.h: Correct prototypes to match definition. 1997-03-08 18:55 Ulrich Drepper * sysdeps/alpha/__math.h: Remove cabs inline definition. Reported by Philip Blundell . Reported by Andreas Schwab . Bug report by Andreas Jaeger . --- sysdeps/posix/euidaccess.c | 63 +++++++++++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 29 deletions(-) (limited to 'sysdeps/posix') diff --git a/sysdeps/posix/euidaccess.c b/sysdeps/posix/euidaccess.c index 04648ce08b..ed59582154 100644 --- a/sysdeps/posix/euidaccess.c +++ b/sysdeps/posix/euidaccess.c @@ -1,22 +1,21 @@ -/* euidaccess -- check if effective user id can access file - Copyright (C) 1990, 1991, 1995, 1996 Free Software Foundation, Inc. +/* Check if effective user id can access file + Copyright (C) 1990, 1991, 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. -This file is part of the GNU C Library. + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. -The GNU C Library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. -The GNU C Library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ /* Written by David MacKenzie and Torbjorn Granlund. Adapted for GNU C library by Roland McGrath. */ @@ -95,6 +94,7 @@ extern int errno; #ifdef _LIBC #define group_member __group_member +#define euidaccess __euidaccess #else @@ -104,6 +104,14 @@ static uid_t uid; /* The user's real group id. */ static gid_t gid; +#ifdef HAVE_GETGROUPS +int group_member (); +#else +#define group_member(gid) 0 +#endif + +#endif + /* The user's effective user id. */ static uid_t euid; @@ -113,14 +121,6 @@ static gid_t egid; /* Nonzero if UID, GID, EUID, and EGID have valid values. */ static int have_ids = 0; -#ifdef HAVE_GETGROUPS -int group_member (); -#else -#define group_member(gid) 0 -#endif - -#endif - /* Return 0 if the user has permission of type MODE on file PATH; otherwise, return -1 and set `errno' to EACCESS. @@ -137,9 +137,6 @@ euidaccess (path, mode) int granted; #ifdef _LIBC - uid_t euid; - gid_t egid; - if (! __libc_enable_secure) /* If we are not set-uid or set-gid, access does the same. */ return access (path, mode); @@ -171,8 +168,12 @@ euidaccess (path, mode) #ifdef _LIBC /* Now we need the IDs. */ - euid = geteuid (); - egid = getegid (); + if (have_ids == 0) + { + have_ids = 1; + euid = geteuid (); + egid = getegid (); + } #endif /* The super-user can read and write any file, and execute any file @@ -192,6 +193,10 @@ euidaccess (path, mode) __set_errno (EACCESS); return -1; } +#undef euidaccess +#ifdef weak_alias +weak_alias (__euidaccess, euidaccess) +#endif #ifdef TEST #include -- cgit v1.2.3