aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorPaul Eggert2017-08-09 11:38:04 -0700
committerPaul Eggert2017-08-09 11:46:06 -0700
commit904be8c4cf8522a54a85542954bd553b6dbd0b64 (patch)
tree7f0c1eac5585e02a5461b36224490938cbcf3e92 /lib
parent7fc27ea70bc7dc24776b2c098ac970f2f21e37fb (diff)
downloademacs-904be8c4cf8522a54a85542954bd553b6dbd0b64.tar.gz
emacs-904be8c4cf8522a54a85542954bd553b6dbd0b64.zip
Merge from gnulib
This incorporates: 2017-08-09 tempname: do not depend on secure_getenv 2017-08-08 extensions: add _OPENBSD_SOURCE 2017-08-06 manywarnings: Add support for C++ 2017-08-06 warnings, manywarnings: Add support for multiple languages * admin/merge-gnulib: Don't use m4/manywarnings-c++.m4. * lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate. * lib/secure_getenv.c, m4/secure_getenv.m4: Remove. * lib/tempname.c, m4/extensions.m4, m4/manywarnings.m4, m4/warnings.m4: Copy from gnulib.
Diffstat (limited to 'lib')
-rw-r--r--lib/gnulib.mk.in14
-rw-r--r--lib/secure_getenv.c54
-rw-r--r--lib/tempname.c1
3 files changed, 0 insertions, 69 deletions
diff --git a/lib/gnulib.mk.in b/lib/gnulib.mk.in
index a385c8c8384..c5df3f42e47 100644
--- a/lib/gnulib.mk.in
+++ b/lib/gnulib.mk.in
@@ -903,7 +903,6 @@ gl_GNULIB_ENABLED_dosname = @gl_GNULIB_ENABLED_dosname@
903gl_GNULIB_ENABLED_euidaccess = @gl_GNULIB_ENABLED_euidaccess@ 903gl_GNULIB_ENABLED_euidaccess = @gl_GNULIB_ENABLED_euidaccess@
904gl_GNULIB_ENABLED_getdtablesize = @gl_GNULIB_ENABLED_getdtablesize@ 904gl_GNULIB_ENABLED_getdtablesize = @gl_GNULIB_ENABLED_getdtablesize@
905gl_GNULIB_ENABLED_getgroups = @gl_GNULIB_ENABLED_getgroups@ 905gl_GNULIB_ENABLED_getgroups = @gl_GNULIB_ENABLED_getgroups@
906gl_GNULIB_ENABLED_secure_getenv = @gl_GNULIB_ENABLED_secure_getenv@
907gl_GNULIB_ENABLED_strtoll = @gl_GNULIB_ENABLED_strtoll@ 906gl_GNULIB_ENABLED_strtoll = @gl_GNULIB_ENABLED_strtoll@
908gl_GNULIB_ENABLED_tempname = @gl_GNULIB_ENABLED_tempname@ 907gl_GNULIB_ENABLED_tempname = @gl_GNULIB_ENABLED_tempname@
909gl_LIBOBJS = @gl_LIBOBJS@ 908gl_LIBOBJS = @gl_LIBOBJS@
@@ -1912,19 +1911,6 @@ EXTRA_DIST += root-uid.h
1912endif 1911endif
1913## end gnulib module root-uid 1912## end gnulib module root-uid
1914 1913
1915## begin gnulib module secure_getenv
1916ifeq (,$(OMIT_GNULIB_MODULE_secure_getenv))
1917
1918ifneq (,$(gl_GNULIB_ENABLED_secure_getenv))
1919
1920endif
1921EXTRA_DIST += secure_getenv.c
1922
1923EXTRA_libgnu_a_SOURCES += secure_getenv.c
1924
1925endif
1926## end gnulib module secure_getenv
1927
1928## begin gnulib module sig2str 1914## begin gnulib module sig2str
1929ifeq (,$(OMIT_GNULIB_MODULE_sig2str)) 1915ifeq (,$(OMIT_GNULIB_MODULE_sig2str))
1930 1916
diff --git a/lib/secure_getenv.c b/lib/secure_getenv.c
deleted file mode 100644
index df53dea0b2f..00000000000
--- a/lib/secure_getenv.c
+++ /dev/null
@@ -1,54 +0,0 @@
1/* Look up an environment variable, returning NULL in insecure situations.
2
3 Copyright 2013-2017 Free Software Foundation, Inc.
4
5 This program is free software: you can redistribute it and/or modify it
6 under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
17
18#include <config.h>
19
20#include <stdlib.h>
21
22#if !HAVE___SECURE_GETENV
23# if HAVE_ISSETUGID || (HAVE_GETUID && HAVE_GETEUID && HAVE_GETGID && HAVE_GETEGID)
24# include <unistd.h>
25# endif
26#endif
27
28char *
29secure_getenv (char const *name)
30{
31#if HAVE___SECURE_GETENV /* glibc */
32 return __secure_getenv (name);
33#elif HAVE_ISSETUGID /* OS X, FreeBSD, NetBSD, OpenBSD */
34 if (issetugid ())
35 return NULL;
36 return getenv (name);
37#elif HAVE_GETUID && HAVE_GETEUID && HAVE_GETGID && HAVE_GETEGID /* other Unix */
38 if (geteuid () != getuid () || getegid () != getgid ())
39 return NULL;
40 return getenv (name);
41#elif (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ /* native Windows */
42 /* On native Windows, there is no such concept as setuid or setgid binaries.
43 - Programs launched as system services have high privileges, but they don't
44 inherit environment variables from a user.
45 - Programs launched by a user with "Run as Administrator" have high
46 privileges and use the environment variables, but the user has been asked
47 whether he agrees.
48 - Programs launched by a user without "Run as Administrator" cannot gain
49 high privileges, therefore there is no risk. */
50 return getenv (name);
51#else
52 return NULL;
53#endif
54}
diff --git a/lib/tempname.c b/lib/tempname.c
index 9c4a3c2a54d..c274b8dd4e1 100644
--- a/lib/tempname.c
+++ b/lib/tempname.c
@@ -69,7 +69,6 @@
69# define __mkdir mkdir 69# define __mkdir mkdir
70# define __open open 70# define __open open
71# define __lxstat64(version, file, buf) lstat (file, buf) 71# define __lxstat64(version, file, buf) lstat (file, buf)
72# define __secure_getenv secure_getenv
73#endif 72#endif
74 73
75#ifdef _LIBC 74#ifdef _LIBC