diff options
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/generic/dl-sysdep.c | 2 | ||||
-rw-r--r-- | sysdeps/generic/enbl-secure.c | 34 | ||||
-rw-r--r-- | sysdeps/mach/hurd/dl-sysdep.c | 2 |
3 files changed, 36 insertions, 2 deletions
diff --git a/sysdeps/generic/dl-sysdep.c b/sysdeps/generic/dl-sysdep.c index 87eac71687..a4b8639bc4 100644 --- a/sysdeps/generic/dl-sysdep.c +++ b/sysdeps/generic/dl-sysdep.c @@ -96,7 +96,7 @@ _dl_sysdep_start (void **start_argptr, SEE (EGID, egid); - _dl_secure = uid != euid || gid != egid; + __libc_enable_secure = uid != euid || gid != egid; #ifdef DL_SYSDEP_INIT DL_SYSDEP_INIT; diff --git a/sysdeps/generic/enbl-secure.c b/sysdeps/generic/enbl-secure.c new file mode 100644 index 0000000000..b7530a8437 --- /dev/null +++ b/sysdeps/generic/enbl-secure.c @@ -0,0 +1,34 @@ +/* Define and initialize the `__libc_enable_secure' flag. Generic version. +Copyright (C) 1996 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 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. */ + +/* This file is used in the static libc. For the shared library, + dl-sysdep.c defines and initializes __libc_enable_secure. */ + +#include <unistd.h> + + +/* Safest assumption, if somehow the initializer isn't run. */ +int __libc_enable_secure = 1; + +static void __attribute__ ((unused, constructor)) +init_secure (void) +{ + __libc_enable_secure = (__geteuid () != __getuid () || + __getegid () != __getgid ()); +} diff --git a/sysdeps/mach/hurd/dl-sysdep.c b/sysdeps/mach/hurd/dl-sysdep.c index ee2bf73469..be0417ca30 100644 --- a/sysdeps/mach/hurd/dl-sysdep.c +++ b/sysdeps/mach/hurd/dl-sysdep.c @@ -107,7 +107,7 @@ _dl_sysdep_start (void **start_argptr, else _dl_hurd_data = (void *) p; - _dl_secure = _dl_hurd_data->flags & EXEC_SECURE; + __libc_enable_secure = _dl_hurd_data->flags & EXEC_SECURE; if (_dl_hurd_data->flags & EXEC_STACK_ARGS && _dl_hurd_data->user_entry == 0) |