diff options
author | Ulrich Drepper <drepper@redhat.com> | 1997-03-17 04:10:16 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1997-03-17 04:10:16 +0000 |
commit | 3365152cb0dc59567f457f130c8905c505719ed1 (patch) | |
tree | bf9ea8af566d8c3ea1f317871ba42252591ee8b7 | |
parent | 4b3769bc7ccc6f2cd6eaf0464f27b3c7025f6215 (diff) | |
download | glibc-3365152cb0dc59567f457f130c8905c505719ed1.tar glibc-3365152cb0dc59567f457f130c8905c505719ed1.tar.gz glibc-3365152cb0dc59567f457f130c8905c505719ed1.tar.bz2 glibc-3365152cb0dc59567f457f130c8905c505719ed1.zip |
Define as __euidaccess and make euidaccess weak alias.
-rw-r--r-- | sysdeps/mach/hurd/euidaccess.c | 5 | ||||
-rw-r--r-- | sysdeps/posix/euidaccess.c | 63 | ||||
-rw-r--r-- | sysdeps/stub/euidaccess.c | 31 |
3 files changed, 53 insertions, 46 deletions
diff --git a/sysdeps/mach/hurd/euidaccess.c b/sysdeps/mach/hurd/euidaccess.c index bbd2d21afe..d206b8644c 100644 --- a/sysdeps/mach/hurd/euidaccess.c +++ b/sysdeps/mach/hurd/euidaccess.c @@ -1,5 +1,5 @@ /* Test for access to FILE using effective UID and GID. Hurd version. -Copyright (C) 1991, 1995 Free Software Foundation, Inc. +Copyright (C) 1991, 1995, 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -24,7 +24,7 @@ Cambridge, MA 02139, USA. */ #include <hurd.h> int -euidaccess (file, type) +__euidaccess (file, type) const char *file; int type; { @@ -56,3 +56,4 @@ euidaccess (file, type) return 0; } +weak_alias (__euidaccess, euidaccess) 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 <stdio.h> diff --git a/sysdeps/stub/euidaccess.c b/sysdeps/stub/euidaccess.c index 79296a77f4..f11c74b8f7 100644 --- a/sysdeps/stub/euidaccess.c +++ b/sysdeps/stub/euidaccess.c @@ -1,28 +1,28 @@ /* Test for access to FILE using effective UID and GID. Stub version. -Copyright (C) 1991, 1995, 1996 Free Software Foundation, Inc. -This file is part of the GNU C Library. + Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc. + 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. */ #include <errno.h> #include <stddef.h> #include <unistd.h> int -euidaccess (file, type) +__euidaccess (file, type) const char *file; int type; { @@ -35,4 +35,5 @@ euidaccess (file, type) __set_errno (ENOSYS); return -1; } +weak_alias (__euidaccess, euidaccess) stub_warning (euidaccess) |