diff options
| author | Paul Eggert | 2012-11-13 20:55:41 -0800 |
|---|---|---|
| committer | Paul Eggert | 2012-11-13 20:55:41 -0800 |
| commit | 73dcdb9f30cb94a3183db54d9b463370c3978d4d (patch) | |
| tree | 216d47d5bc96bce2a4ca87a57967b0e1c3c151f2 /m4 | |
| parent | 9c3912d3d9aaa1e20e3f7168f5764695ad5e43fd (diff) | |
| download | emacs-73dcdb9f30cb94a3183db54d9b463370c3978d4d.tar.gz emacs-73dcdb9f30cb94a3183db54d9b463370c3978d4d.zip | |
Use faccessat, not access, when checking file permissions.
This fixes a bug that has been present in Emacs since its creation.
It was reported by Chris Torek in 1983 even before GNU Emacs existed,
which must set some sort of record. (Torek's bug report was against
a predecessor of GNU Emacs, but GNU Emacs happened to have the
same common flaw.) See Torek's Usenet posting
"setuid/setgid programs & Emacs" Article-I.D.: sri-arpa.858
Posted: Fri Apr 8 14:18:56 1983.
* .bzrignore: Add lib/fcntl.h.
* configure.ac (euidaccess): Remove check; gnulib does this for us now.
(gl_FCNTL_O_FLAGS): Define a dummy version.
* lib/at-func.c, lib/euidaccess.c, lib/faccessat.c, lib/fcntl.in.h:
* lib/getgroups.c, lib/group-member.c, lib/root-uid.h:
* lib/xalloc-oversized.h, m4/euidaccess.m4, m4/faccessat.m4:
* m4/fcntl_h.m4, m4/getgroups.m4, m4/group-member.m4:
New files, from gnulib.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* admin/merge-gnulib (GNULIB_MODULES): Add faccessat.
(GNULIB_TOOL_FLAGS): Avoid at-internal, fchdir, malloc-posix,
openat-die, openat-h, save-cwd. Do not avoid fcntl-h.
Omit gnulib's m4/fcntl-o.m4.
* nt/inc/ms-w32.h (AT_FDCWD, AT_EACCESS): New symbols.
(access): Remove.
(faccessat): New macro.
* src/Makefile.in (LIB_EACCESS): New macro.
(LIBES): Use it.
* src/callproc.c (init_callproc):
* src/charset.c (init_charset):
* src/fileio.c (check_existing, check_executable, check_writable)
(Ffile_readable_p):
* src/lread.c (openp, load_path_check):
* src/process.c (allocate_pty):
* src/xrdb.c (file_p):
Use effective UID when checking permissions, not real UID.
* src/callproc.c (init_callproc):
* src/charset.c (init_charset):
* src/lread.c (load_path_check, init_lread):
Test whether directories are accessible, not merely whether they exist.
* src/conf_post.h (GNULIB_SUPPORT_ONLY_AT_FDCWD): New macro.
* src/fileio.c (check_existing, check_executable, check_writable)
(Ffile_readable_p):
Use symbolic names instead of integers for the flags, as they're
portable now.
(check_writable): New arg AMODE. All uses changed.
Set errno on failure.
(Ffile_readable_p): Use faccessat, not stat + open + close.
(Ffile_writable_p): No need to call check_existing + check_writable.
Just call check_writable and then look at errno. This saves a syscall.
dir should never be nil; replace an unnecessary runtime check
with an eassert. When checking the parent directory of a nonexistent
file, check that the directory is searchable as well as writable, as
we can't create files in unsearchable directories.
(file_directory_p): New function, which uses 'stat' on most platforms
but faccessat with D_OK (for efficiency) if WINDOWSNT.
(Ffile_directory_p, Fset_file_times): Use it.
(file_accessible_directory_p): New function, which uses a single
syscall for efficiency.
(Ffile_accessible_directory_p): Use it.
* src/xrdb.c (file_p): Use file_directory_p.
* src/lisp.h (file_directory_p, file_accessible_directory_p): New decls.
* src/lread.c (openp): When opening a file, use fstat rather than
stat, as that avoids a permissions race. When not opening a file,
use file_directory_p rather than stat.
(dir_warning): First arg is now a usage string, not a format.
Use errno. All uses changed.
* src/nsterm.m (ns_term_init): Remove unnecessary call to file-readable
that merely introduced a race.
* src/process.c, src/sysdep.c, src/term.c: All uses of '#ifdef O_NONBLOCK'
changed to '#if O_NONBLOCK', to accommodate gnulib O_* style,
and similarly for the other O_* flags.
* src/w32.c (sys_faccessat): Rename from sys_access and switch to
faccessat's API. All uses changed.
* src/xrdb.c: Do not include <sys/stat.h>; no longer needed.
(magic_db): Rename from magic_file_p.
(magic_db, search_magic_path): Return an XrmDatabase rather than a
char *, so that we don't have to test for file existence
separately from opening the file for reading. This removes a race
fixes a permission-checking problem, and simplifies the code.
All uses changed.
(file_p): Remove; no longer needed.
Fixes: debbugs:12632
Diffstat (limited to 'm4')
| -rw-r--r-- | m4/euidaccess.m4 | 52 | ||||
| -rw-r--r-- | m4/faccessat.m4 | 28 | ||||
| -rw-r--r-- | m4/fcntl_h.m4 | 50 | ||||
| -rw-r--r-- | m4/getgroups.m4 | 107 | ||||
| -rw-r--r-- | m4/gnulib-comp.m4 | 105 | ||||
| -rw-r--r-- | m4/group-member.m4 | 29 |
6 files changed, 371 insertions, 0 deletions
diff --git a/m4/euidaccess.m4 b/m4/euidaccess.m4 new file mode 100644 index 00000000000..2de95b88ba8 --- /dev/null +++ b/m4/euidaccess.m4 | |||
| @@ -0,0 +1,52 @@ | |||
| 1 | # euidaccess.m4 serial 15 | ||
| 2 | dnl Copyright (C) 2002-2012 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | ||
| 4 | dnl gives unlimited permission to copy and/or distribute it, | ||
| 5 | dnl with or without modifications, as long as this notice is preserved. | ||
| 6 | |||
| 7 | AC_DEFUN([gl_FUNC_NONREENTRANT_EUIDACCESS], | ||
| 8 | [ | ||
| 9 | AC_REQUIRE([gl_FUNC_EUIDACCESS]) | ||
| 10 | AC_CHECK_DECLS([setregid]) | ||
| 11 | AC_DEFINE([PREFER_NONREENTRANT_EUIDACCESS], [1], | ||
| 12 | [Define this if you prefer euidaccess to return the correct result | ||
| 13 | even if this would make it nonreentrant. Define this only if your | ||
| 14 | entire application is safe even if the uid or gid might temporarily | ||
| 15 | change. If your application uses signal handlers or threads it | ||
| 16 | is probably not safe.]) | ||
| 17 | ]) | ||
| 18 | |||
| 19 | AC_DEFUN([gl_FUNC_EUIDACCESS], | ||
| 20 | [ | ||
| 21 | AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) | ||
| 22 | |||
| 23 | dnl Persuade glibc <unistd.h> to declare euidaccess(). | ||
| 24 | AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) | ||
| 25 | |||
| 26 | AC_CHECK_FUNCS([euidaccess]) | ||
| 27 | if test $ac_cv_func_euidaccess = no; then | ||
| 28 | HAVE_EUIDACCESS=0 | ||
| 29 | fi | ||
| 30 | ]) | ||
| 31 | |||
| 32 | # Prerequisites of lib/euidaccess.c. | ||
| 33 | AC_DEFUN([gl_PREREQ_EUIDACCESS], [ | ||
| 34 | dnl Prefer POSIX faccessat over non-standard euidaccess. | ||
| 35 | AC_CHECK_FUNCS_ONCE([faccessat]) | ||
| 36 | dnl Try various other non-standard fallbacks. | ||
| 37 | AC_CHECK_HEADERS([libgen.h]) | ||
| 38 | AC_FUNC_GETGROUPS | ||
| 39 | |||
| 40 | # Solaris 9 and 10 need -lgen to get the eaccess function. | ||
| 41 | # Save and restore LIBS so -lgen isn't added to it. Otherwise, *all* | ||
| 42 | # programs in the package would end up linked with that potentially-shared | ||
| 43 | # library, inducing unnecessary run-time overhead. | ||
| 44 | LIB_EACCESS= | ||
| 45 | AC_SUBST([LIB_EACCESS]) | ||
| 46 | gl_saved_libs=$LIBS | ||
| 47 | AC_SEARCH_LIBS([eaccess], [gen], | ||
| 48 | [test "$ac_cv_search_eaccess" = "none required" || | ||
| 49 | LIB_EACCESS=$ac_cv_search_eaccess]) | ||
| 50 | AC_CHECK_FUNCS([eaccess]) | ||
| 51 | LIBS=$gl_saved_libs | ||
| 52 | ]) | ||
diff --git a/m4/faccessat.m4 b/m4/faccessat.m4 new file mode 100644 index 00000000000..82f3b1f8dde --- /dev/null +++ b/m4/faccessat.m4 | |||
| @@ -0,0 +1,28 @@ | |||
| 1 | # serial 6 | ||
| 2 | # See if we need to provide faccessat replacement. | ||
| 3 | |||
| 4 | dnl Copyright (C) 2009-2012 Free Software Foundation, Inc. | ||
| 5 | dnl This file is free software; the Free Software Foundation | ||
| 6 | dnl gives unlimited permission to copy and/or distribute it, | ||
| 7 | dnl with or without modifications, as long as this notice is preserved. | ||
| 8 | |||
| 9 | # Written by Eric Blake. | ||
| 10 | |||
| 11 | AC_DEFUN([gl_FUNC_FACCESSAT], | ||
| 12 | [ | ||
| 13 | AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) | ||
| 14 | |||
| 15 | dnl Persuade glibc <unistd.h> to declare faccessat(). | ||
| 16 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) | ||
| 17 | |||
| 18 | AC_CHECK_FUNCS_ONCE([faccessat]) | ||
| 19 | if test $ac_cv_func_faccessat = no; then | ||
| 20 | HAVE_FACCESSAT=0 | ||
| 21 | fi | ||
| 22 | ]) | ||
| 23 | |||
| 24 | # Prerequisites of lib/faccessat.m4. | ||
| 25 | AC_DEFUN([gl_PREREQ_FACCESSAT], | ||
| 26 | [ | ||
| 27 | AC_CHECK_FUNCS([access]) | ||
| 28 | ]) | ||
diff --git a/m4/fcntl_h.m4 b/m4/fcntl_h.m4 new file mode 100644 index 00000000000..cac28aeb283 --- /dev/null +++ b/m4/fcntl_h.m4 | |||
| @@ -0,0 +1,50 @@ | |||
| 1 | # serial 15 | ||
| 2 | # Configure fcntl.h. | ||
| 3 | dnl Copyright (C) 2006-2007, 2009-2012 Free Software Foundation, Inc. | ||
| 4 | dnl This file is free software; the Free Software Foundation | ||
| 5 | dnl gives unlimited permission to copy and/or distribute it, | ||
| 6 | dnl with or without modifications, as long as this notice is preserved. | ||
| 7 | |||
| 8 | dnl Written by Paul Eggert. | ||
| 9 | |||
| 10 | AC_DEFUN([gl_FCNTL_H], | ||
| 11 | [ | ||
| 12 | AC_REQUIRE([gl_FCNTL_H_DEFAULTS]) | ||
| 13 | AC_REQUIRE([gl_FCNTL_O_FLAGS]) | ||
| 14 | gl_NEXT_HEADERS([fcntl.h]) | ||
| 15 | |||
| 16 | dnl Ensure the type pid_t gets defined. | ||
| 17 | AC_REQUIRE([AC_TYPE_PID_T]) | ||
| 18 | |||
| 19 | dnl Ensure the type mode_t gets defined. | ||
| 20 | AC_REQUIRE([AC_TYPE_MODE_T]) | ||
| 21 | |||
| 22 | dnl Check for declarations of anything we want to poison if the | ||
| 23 | dnl corresponding gnulib module is not in use, if it is not common | ||
| 24 | dnl enough to be declared everywhere. | ||
| 25 | gl_WARN_ON_USE_PREPARE([[#include <fcntl.h> | ||
| 26 | ]], [fcntl openat]) | ||
| 27 | ]) | ||
| 28 | |||
| 29 | AC_DEFUN([gl_FCNTL_MODULE_INDICATOR], | ||
| 30 | [ | ||
| 31 | dnl Use AC_REQUIRE here, so that the default settings are expanded once only. | ||
| 32 | AC_REQUIRE([gl_FCNTL_H_DEFAULTS]) | ||
| 33 | gl_MODULE_INDICATOR_SET_VARIABLE([$1]) | ||
| 34 | dnl Define it also as a C macro, for the benefit of the unit tests. | ||
| 35 | gl_MODULE_INDICATOR_FOR_TESTS([$1]) | ||
| 36 | ]) | ||
| 37 | |||
| 38 | AC_DEFUN([gl_FCNTL_H_DEFAULTS], | ||
| 39 | [ | ||
| 40 | GNULIB_FCNTL=0; AC_SUBST([GNULIB_FCNTL]) | ||
| 41 | GNULIB_NONBLOCKING=0; AC_SUBST([GNULIB_NONBLOCKING]) | ||
| 42 | GNULIB_OPEN=0; AC_SUBST([GNULIB_OPEN]) | ||
| 43 | GNULIB_OPENAT=0; AC_SUBST([GNULIB_OPENAT]) | ||
| 44 | dnl Assume proper GNU behavior unless another module says otherwise. | ||
| 45 | HAVE_FCNTL=1; AC_SUBST([HAVE_FCNTL]) | ||
| 46 | HAVE_OPENAT=1; AC_SUBST([HAVE_OPENAT]) | ||
| 47 | REPLACE_FCNTL=0; AC_SUBST([REPLACE_FCNTL]) | ||
| 48 | REPLACE_OPEN=0; AC_SUBST([REPLACE_OPEN]) | ||
| 49 | REPLACE_OPENAT=0; AC_SUBST([REPLACE_OPENAT]) | ||
| 50 | ]) | ||
diff --git a/m4/getgroups.m4 b/m4/getgroups.m4 new file mode 100644 index 00000000000..17473af486b --- /dev/null +++ b/m4/getgroups.m4 | |||
| @@ -0,0 +1,107 @@ | |||
| 1 | # serial 18 | ||
| 2 | |||
| 3 | dnl From Jim Meyering. | ||
| 4 | dnl A wrapper around AC_FUNC_GETGROUPS. | ||
| 5 | |||
| 6 | # Copyright (C) 1996-1997, 1999-2004, 2008-2012 Free Software Foundation, Inc. | ||
| 7 | # | ||
| 8 | # This file is free software; the Free Software Foundation | ||
| 9 | # gives unlimited permission to copy and/or distribute it, | ||
| 10 | # with or without modifications, as long as this notice is preserved. | ||
| 11 | |||
| 12 | m4_version_prereq([2.70], [] ,[ | ||
| 13 | |||
| 14 | # This is taken from the following Autoconf patch: | ||
| 15 | # http://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=7fbb553727ed7e0e689a17594b58559ecf3ea6e9 | ||
| 16 | AC_DEFUN([AC_FUNC_GETGROUPS], | ||
| 17 | [ | ||
| 18 | AC_REQUIRE([AC_TYPE_GETGROUPS])dnl | ||
| 19 | AC_REQUIRE([AC_TYPE_SIZE_T])dnl | ||
| 20 | AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles | ||
| 21 | AC_CHECK_FUNC([getgroups]) | ||
| 22 | |||
| 23 | # If we don't yet have getgroups, see if it's in -lbsd. | ||
| 24 | # This is reported to be necessary on an ITOS 3000WS running SEIUX 3.1. | ||
| 25 | ac_save_LIBS=$LIBS | ||
| 26 | if test $ac_cv_func_getgroups = no; then | ||
| 27 | AC_CHECK_LIB(bsd, getgroups, [GETGROUPS_LIB=-lbsd]) | ||
| 28 | fi | ||
| 29 | |||
| 30 | # Run the program to test the functionality of the system-supplied | ||
| 31 | # getgroups function only if there is such a function. | ||
| 32 | if test $ac_cv_func_getgroups = yes; then | ||
| 33 | AC_CACHE_CHECK([for working getgroups], [ac_cv_func_getgroups_works], | ||
| 34 | [AC_RUN_IFELSE( | ||
| 35 | [AC_LANG_PROGRAM( | ||
| 36 | [AC_INCLUDES_DEFAULT], | ||
| 37 | [[/* On Ultrix 4.3, getgroups (0, 0) always fails. */ | ||
| 38 | return getgroups (0, 0) == -1;]]) | ||
| 39 | ], | ||
| 40 | [ac_cv_func_getgroups_works=yes], | ||
| 41 | [ac_cv_func_getgroups_works=no], | ||
| 42 | [case "$host_os" in # (( | ||
| 43 | # Guess yes on glibc systems. | ||
| 44 | *-gnu*) ac_cv_func_getgroups_works="guessing yes" ;; | ||
| 45 | # If we don't know, assume the worst. | ||
| 46 | *) ac_cv_func_getgroups_works="guessing no" ;; | ||
| 47 | esac | ||
| 48 | ]) | ||
| 49 | ]) | ||
| 50 | else | ||
| 51 | ac_cv_func_getgroups_works=no | ||
| 52 | fi | ||
| 53 | case "$ac_cv_func_getgroups_works" in | ||
| 54 | *yes) | ||
| 55 | AC_DEFINE([HAVE_GETGROUPS], [1], | ||
| 56 | [Define to 1 if your system has a working `getgroups' function.]) | ||
| 57 | ;; | ||
| 58 | esac | ||
| 59 | LIBS=$ac_save_LIBS | ||
| 60 | ])# AC_FUNC_GETGROUPS | ||
| 61 | |||
| 62 | ]) | ||
| 63 | |||
| 64 | AC_DEFUN([gl_FUNC_GETGROUPS], | ||
| 65 | [ | ||
| 66 | AC_REQUIRE([AC_TYPE_GETGROUPS]) | ||
| 67 | AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) | ||
| 68 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
| 69 | |||
| 70 | AC_FUNC_GETGROUPS | ||
| 71 | if test $ac_cv_func_getgroups != yes; then | ||
| 72 | HAVE_GETGROUPS=0 | ||
| 73 | else | ||
| 74 | if test "$ac_cv_type_getgroups" != gid_t \ | ||
| 75 | || { case "$ac_cv_func_getgroups_works" in | ||
| 76 | *yes) false;; | ||
| 77 | *) true;; | ||
| 78 | esac | ||
| 79 | }; then | ||
| 80 | REPLACE_GETGROUPS=1 | ||
| 81 | AC_DEFINE([GETGROUPS_ZERO_BUG], [1], [Define this to 1 if | ||
| 82 | getgroups(0,NULL) does not return the number of groups.]) | ||
| 83 | else | ||
| 84 | dnl Detect FreeBSD bug; POSIX requires getgroups(-1,ptr) to fail. | ||
| 85 | AC_CACHE_CHECK([whether getgroups handles negative values], | ||
| 86 | [gl_cv_func_getgroups_works], | ||
| 87 | [AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], | ||
| 88 | [[int size = getgroups (0, 0); | ||
| 89 | gid_t *list = malloc (size * sizeof *list); | ||
| 90 | return getgroups (-1, list) != -1;]])], | ||
| 91 | [gl_cv_func_getgroups_works=yes], | ||
| 92 | [gl_cv_func_getgroups_works=no], | ||
| 93 | [case "$host_os" in | ||
| 94 | # Guess yes on glibc systems. | ||
| 95 | *-gnu*) gl_cv_func_getgroups_works="guessing yes" ;; | ||
| 96 | # If we don't know, assume the worst. | ||
| 97 | *) gl_cv_func_getgroups_works="guessing no" ;; | ||
| 98 | esac | ||
| 99 | ])]) | ||
| 100 | case "$gl_cv_func_getgroups_works" in | ||
| 101 | *yes) ;; | ||
| 102 | *) REPLACE_GETGROUPS=1 ;; | ||
| 103 | esac | ||
| 104 | fi | ||
| 105 | fi | ||
| 106 | test -n "$GETGROUPS_LIB" && LIBS="$GETGROUPS_LIB $LIBS" | ||
| 107 | ]) | ||
diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4 index 5cd278454e7..30f81b4781f 100644 --- a/m4/gnulib-comp.m4 +++ b/m4/gnulib-comp.m4 | |||
| @@ -54,18 +54,23 @@ AC_DEFUN([gl_EARLY], | |||
| 54 | # Code from module dtotimespec: | 54 | # Code from module dtotimespec: |
| 55 | # Code from module dup2: | 55 | # Code from module dup2: |
| 56 | # Code from module environ: | 56 | # Code from module environ: |
| 57 | # Code from module euidaccess: | ||
| 57 | # Code from module execinfo: | 58 | # Code from module execinfo: |
| 58 | # Code from module extensions: | 59 | # Code from module extensions: |
| 59 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) | 60 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) |
| 60 | # Code from module extern-inline: | 61 | # Code from module extern-inline: |
| 62 | # Code from module faccessat: | ||
| 63 | # Code from module fcntl-h: | ||
| 61 | # Code from module filemode: | 64 | # Code from module filemode: |
| 62 | # Code from module fpending: | 65 | # Code from module fpending: |
| 66 | # Code from module getgroups: | ||
| 63 | # Code from module getloadavg: | 67 | # Code from module getloadavg: |
| 64 | # Code from module getopt-gnu: | 68 | # Code from module getopt-gnu: |
| 65 | # Code from module getopt-posix: | 69 | # Code from module getopt-posix: |
| 66 | # Code from module gettext-h: | 70 | # Code from module gettext-h: |
| 67 | # Code from module gettime: | 71 | # Code from module gettime: |
| 68 | # Code from module gettimeofday: | 72 | # Code from module gettimeofday: |
| 73 | # Code from module group-member: | ||
| 69 | # Code from module ignore-value: | 74 | # Code from module ignore-value: |
| 70 | # Code from module include_next: | 75 | # Code from module include_next: |
| 71 | # Code from module intprops: | 76 | # Code from module intprops: |
| @@ -81,6 +86,7 @@ AC_DEFUN([gl_EARLY], | |||
| 81 | # Code from module pselect: | 86 | # Code from module pselect: |
| 82 | # Code from module pthread_sigmask: | 87 | # Code from module pthread_sigmask: |
| 83 | # Code from module readlink: | 88 | # Code from module readlink: |
| 89 | # Code from module root-uid: | ||
| 84 | # Code from module signal-h: | 90 | # Code from module signal-h: |
| 85 | # Code from module snippet/_Noreturn: | 91 | # Code from module snippet/_Noreturn: |
| 86 | # Code from module snippet/arg-nonnull: | 92 | # Code from module snippet/arg-nonnull: |
| @@ -122,6 +128,7 @@ AC_DEFUN([gl_EARLY], | |||
| 122 | # Code from module utimens: | 128 | # Code from module utimens: |
| 123 | # Code from module verify: | 129 | # Code from module verify: |
| 124 | # Code from module warnings: | 130 | # Code from module warnings: |
| 131 | # Code from module xalloc-oversized: | ||
| 125 | ]) | 132 | ]) |
| 126 | 133 | ||
| 127 | # This macro should be invoked from ./configure.ac, in the section | 134 | # This macro should be invoked from ./configure.ac, in the section |
| @@ -160,6 +167,14 @@ AC_DEFUN([gl_INIT], | |||
| 160 | gl_UNISTD_MODULE_INDICATOR([environ]) | 167 | gl_UNISTD_MODULE_INDICATOR([environ]) |
| 161 | gl_EXECINFO_H | 168 | gl_EXECINFO_H |
| 162 | AC_REQUIRE([gl_EXTERN_INLINE]) | 169 | AC_REQUIRE([gl_EXTERN_INLINE]) |
| 170 | gl_FUNC_FACCESSAT | ||
| 171 | if test $HAVE_FACCESSAT = 0; then | ||
| 172 | AC_LIBOBJ([faccessat]) | ||
| 173 | gl_PREREQ_FACCESSAT | ||
| 174 | fi | ||
| 175 | gl_MODULE_INDICATOR([faccessat]) | ||
| 176 | gl_UNISTD_MODULE_INDICATOR([faccessat]) | ||
| 177 | gl_FCNTL_H | ||
| 163 | gl_FILEMODE | 178 | gl_FILEMODE |
| 164 | gl_FUNC_FPENDING | 179 | gl_FUNC_FPENDING |
| 165 | if test $ac_cv_func___fpending = no; then | 180 | if test $ac_cv_func___fpending = no; then |
| @@ -278,18 +293,53 @@ AC_DEFUN([gl_INIT], | |||
| 278 | gl_UNISTD_H | 293 | gl_UNISTD_H |
| 279 | gl_UTIMENS | 294 | gl_UTIMENS |
| 280 | gl_gnulib_enabled_dosname=false | 295 | gl_gnulib_enabled_dosname=false |
| 296 | gl_gnulib_enabled_euidaccess=false | ||
| 297 | gl_gnulib_enabled_getgroups=false | ||
| 281 | gl_gnulib_enabled_be453cec5eecf5731a274f2de7f2db36=false | 298 | gl_gnulib_enabled_be453cec5eecf5731a274f2de7f2db36=false |
| 299 | gl_gnulib_enabled_a9786850e999ae65a836a6041e8e5ed1=false | ||
| 282 | gl_gnulib_enabled_pathmax=false | 300 | gl_gnulib_enabled_pathmax=false |
| 301 | gl_gnulib_enabled_6099e9737f757db36c47fa9d9f02e88c=false | ||
| 283 | gl_gnulib_enabled_stat=false | 302 | gl_gnulib_enabled_stat=false |
| 284 | gl_gnulib_enabled_strtoll=false | 303 | gl_gnulib_enabled_strtoll=false |
| 285 | gl_gnulib_enabled_strtoull=false | 304 | gl_gnulib_enabled_strtoull=false |
| 286 | gl_gnulib_enabled_verify=false | 305 | gl_gnulib_enabled_verify=false |
| 306 | gl_gnulib_enabled_682e609604ccaac6be382e4ee3a4eaec=false | ||
| 287 | func_gl_gnulib_m4code_dosname () | 307 | func_gl_gnulib_m4code_dosname () |
| 288 | { | 308 | { |
| 289 | if ! $gl_gnulib_enabled_dosname; then | 309 | if ! $gl_gnulib_enabled_dosname; then |
| 290 | gl_gnulib_enabled_dosname=true | 310 | gl_gnulib_enabled_dosname=true |
| 291 | fi | 311 | fi |
| 292 | } | 312 | } |
| 313 | func_gl_gnulib_m4code_euidaccess () | ||
| 314 | { | ||
| 315 | if ! $gl_gnulib_enabled_euidaccess; then | ||
| 316 | gl_FUNC_EUIDACCESS | ||
| 317 | if test $HAVE_EUIDACCESS = 0; then | ||
| 318 | AC_LIBOBJ([euidaccess]) | ||
| 319 | gl_PREREQ_EUIDACCESS | ||
| 320 | fi | ||
| 321 | gl_UNISTD_MODULE_INDICATOR([euidaccess]) | ||
| 322 | gl_gnulib_enabled_euidaccess=true | ||
| 323 | if test $HAVE_EUIDACCESS = 0; then | ||
| 324 | func_gl_gnulib_m4code_a9786850e999ae65a836a6041e8e5ed1 | ||
| 325 | fi | ||
| 326 | func_gl_gnulib_m4code_6099e9737f757db36c47fa9d9f02e88c | ||
| 327 | if test $HAVE_EUIDACCESS = 0; then | ||
| 328 | func_gl_gnulib_m4code_stat | ||
| 329 | fi | ||
| 330 | fi | ||
| 331 | } | ||
| 332 | func_gl_gnulib_m4code_getgroups () | ||
| 333 | { | ||
| 334 | if ! $gl_gnulib_enabled_getgroups; then | ||
| 335 | gl_FUNC_GETGROUPS | ||
| 336 | if test $HAVE_GETGROUPS = 0 || test $REPLACE_GETGROUPS = 1; then | ||
| 337 | AC_LIBOBJ([getgroups]) | ||
| 338 | fi | ||
| 339 | gl_UNISTD_MODULE_INDICATOR([getgroups]) | ||
| 340 | gl_gnulib_enabled_getgroups=true | ||
| 341 | fi | ||
| 342 | } | ||
| 293 | func_gl_gnulib_m4code_be453cec5eecf5731a274f2de7f2db36 () | 343 | func_gl_gnulib_m4code_be453cec5eecf5731a274f2de7f2db36 () |
| 294 | { | 344 | { |
| 295 | if ! $gl_gnulib_enabled_be453cec5eecf5731a274f2de7f2db36; then | 345 | if ! $gl_gnulib_enabled_be453cec5eecf5731a274f2de7f2db36; then |
| @@ -298,6 +348,24 @@ AC_DEFUN([gl_INIT], | |||
| 298 | gl_gnulib_enabled_be453cec5eecf5731a274f2de7f2db36=true | 348 | gl_gnulib_enabled_be453cec5eecf5731a274f2de7f2db36=true |
| 299 | fi | 349 | fi |
| 300 | } | 350 | } |
| 351 | func_gl_gnulib_m4code_a9786850e999ae65a836a6041e8e5ed1 () | ||
| 352 | { | ||
| 353 | if ! $gl_gnulib_enabled_a9786850e999ae65a836a6041e8e5ed1; then | ||
| 354 | gl_FUNC_GROUP_MEMBER | ||
| 355 | if test $HAVE_GROUP_MEMBER = 0; then | ||
| 356 | AC_LIBOBJ([group-member]) | ||
| 357 | gl_PREREQ_GROUP_MEMBER | ||
| 358 | fi | ||
| 359 | gl_UNISTD_MODULE_INDICATOR([group-member]) | ||
| 360 | gl_gnulib_enabled_a9786850e999ae65a836a6041e8e5ed1=true | ||
| 361 | if test $HAVE_GROUP_MEMBER = 0; then | ||
| 362 | func_gl_gnulib_m4code_getgroups | ||
| 363 | fi | ||
| 364 | if test $HAVE_GROUP_MEMBER = 0; then | ||
| 365 | func_gl_gnulib_m4code_682e609604ccaac6be382e4ee3a4eaec | ||
| 366 | fi | ||
| 367 | fi | ||
| 368 | } | ||
| 301 | func_gl_gnulib_m4code_pathmax () | 369 | func_gl_gnulib_m4code_pathmax () |
| 302 | { | 370 | { |
| 303 | if ! $gl_gnulib_enabled_pathmax; then | 371 | if ! $gl_gnulib_enabled_pathmax; then |
| @@ -305,6 +373,12 @@ AC_DEFUN([gl_INIT], | |||
| 305 | gl_gnulib_enabled_pathmax=true | 373 | gl_gnulib_enabled_pathmax=true |
| 306 | fi | 374 | fi |
| 307 | } | 375 | } |
| 376 | func_gl_gnulib_m4code_6099e9737f757db36c47fa9d9f02e88c () | ||
| 377 | { | ||
| 378 | if ! $gl_gnulib_enabled_6099e9737f757db36c47fa9d9f02e88c; then | ||
| 379 | gl_gnulib_enabled_6099e9737f757db36c47fa9d9f02e88c=true | ||
| 380 | fi | ||
| 381 | } | ||
| 308 | func_gl_gnulib_m4code_stat () | 382 | func_gl_gnulib_m4code_stat () |
| 309 | { | 383 | { |
| 310 | if ! $gl_gnulib_enabled_stat; then | 384 | if ! $gl_gnulib_enabled_stat; then |
| @@ -356,6 +430,18 @@ AC_DEFUN([gl_INIT], | |||
| 356 | gl_gnulib_enabled_verify=true | 430 | gl_gnulib_enabled_verify=true |
| 357 | fi | 431 | fi |
| 358 | } | 432 | } |
| 433 | func_gl_gnulib_m4code_682e609604ccaac6be382e4ee3a4eaec () | ||
| 434 | { | ||
| 435 | if ! $gl_gnulib_enabled_682e609604ccaac6be382e4ee3a4eaec; then | ||
| 436 | gl_gnulib_enabled_682e609604ccaac6be382e4ee3a4eaec=true | ||
| 437 | fi | ||
| 438 | } | ||
| 439 | if test $HAVE_FACCESSAT = 0; then | ||
| 440 | func_gl_gnulib_m4code_dosname | ||
| 441 | fi | ||
| 442 | if test $HAVE_FACCESSAT = 0; then | ||
| 443 | func_gl_gnulib_m4code_euidaccess | ||
| 444 | fi | ||
| 359 | if test $REPLACE_GETOPT = 1; then | 445 | if test $REPLACE_GETOPT = 1; then |
| 360 | func_gl_gnulib_m4code_be453cec5eecf5731a274f2de7f2db36 | 446 | func_gl_gnulib_m4code_be453cec5eecf5731a274f2de7f2db36 |
| 361 | fi | 447 | fi |
| @@ -382,12 +468,17 @@ AC_DEFUN([gl_INIT], | |||
| 382 | fi | 468 | fi |
| 383 | m4_pattern_allow([^gl_GNULIB_ENABLED_]) | 469 | m4_pattern_allow([^gl_GNULIB_ENABLED_]) |
| 384 | AM_CONDITIONAL([gl_GNULIB_ENABLED_dosname], [$gl_gnulib_enabled_dosname]) | 470 | AM_CONDITIONAL([gl_GNULIB_ENABLED_dosname], [$gl_gnulib_enabled_dosname]) |
| 471 | AM_CONDITIONAL([gl_GNULIB_ENABLED_euidaccess], [$gl_gnulib_enabled_euidaccess]) | ||
| 472 | AM_CONDITIONAL([gl_GNULIB_ENABLED_getgroups], [$gl_gnulib_enabled_getgroups]) | ||
| 385 | AM_CONDITIONAL([gl_GNULIB_ENABLED_be453cec5eecf5731a274f2de7f2db36], [$gl_gnulib_enabled_be453cec5eecf5731a274f2de7f2db36]) | 473 | AM_CONDITIONAL([gl_GNULIB_ENABLED_be453cec5eecf5731a274f2de7f2db36], [$gl_gnulib_enabled_be453cec5eecf5731a274f2de7f2db36]) |
| 474 | AM_CONDITIONAL([gl_GNULIB_ENABLED_a9786850e999ae65a836a6041e8e5ed1], [$gl_gnulib_enabled_a9786850e999ae65a836a6041e8e5ed1]) | ||
| 386 | AM_CONDITIONAL([gl_GNULIB_ENABLED_pathmax], [$gl_gnulib_enabled_pathmax]) | 475 | AM_CONDITIONAL([gl_GNULIB_ENABLED_pathmax], [$gl_gnulib_enabled_pathmax]) |
| 476 | AM_CONDITIONAL([gl_GNULIB_ENABLED_6099e9737f757db36c47fa9d9f02e88c], [$gl_gnulib_enabled_6099e9737f757db36c47fa9d9f02e88c]) | ||
| 387 | AM_CONDITIONAL([gl_GNULIB_ENABLED_stat], [$gl_gnulib_enabled_stat]) | 477 | AM_CONDITIONAL([gl_GNULIB_ENABLED_stat], [$gl_gnulib_enabled_stat]) |
| 388 | AM_CONDITIONAL([gl_GNULIB_ENABLED_strtoll], [$gl_gnulib_enabled_strtoll]) | 478 | AM_CONDITIONAL([gl_GNULIB_ENABLED_strtoll], [$gl_gnulib_enabled_strtoll]) |
| 389 | AM_CONDITIONAL([gl_GNULIB_ENABLED_strtoull], [$gl_gnulib_enabled_strtoull]) | 479 | AM_CONDITIONAL([gl_GNULIB_ENABLED_strtoull], [$gl_gnulib_enabled_strtoull]) |
| 390 | AM_CONDITIONAL([gl_GNULIB_ENABLED_verify], [$gl_gnulib_enabled_verify]) | 480 | AM_CONDITIONAL([gl_GNULIB_ENABLED_verify], [$gl_gnulib_enabled_verify]) |
| 481 | AM_CONDITIONAL([gl_GNULIB_ENABLED_682e609604ccaac6be382e4ee3a4eaec], [$gl_gnulib_enabled_682e609604ccaac6be382e4ee3a4eaec]) | ||
| 391 | # End of code from modules | 482 | # End of code from modules |
| 392 | m4_ifval(gl_LIBSOURCES_LIST, [ | 483 | m4_ifval(gl_LIBSOURCES_LIST, [ |
| 393 | m4_syscmd([test ! -d ]m4_defn([gl_LIBSOURCES_DIR])[ || | 484 | m4_syscmd([test ! -d ]m4_defn([gl_LIBSOURCES_DIR])[ || |
| @@ -536,6 +627,7 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 536 | lib/alloca.in.h | 627 | lib/alloca.in.h |
| 537 | lib/allocator.c | 628 | lib/allocator.c |
| 538 | lib/allocator.h | 629 | lib/allocator.h |
| 630 | lib/at-func.c | ||
| 539 | lib/c-ctype.c | 631 | lib/c-ctype.c |
| 540 | lib/c-ctype.h | 632 | lib/c-ctype.h |
| 541 | lib/c-strcase.h | 633 | lib/c-strcase.h |
| @@ -549,14 +641,18 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 549 | lib/dtoastr.c | 641 | lib/dtoastr.c |
| 550 | lib/dtotimespec.c | 642 | lib/dtotimespec.c |
| 551 | lib/dup2.c | 643 | lib/dup2.c |
| 644 | lib/euidaccess.c | ||
| 552 | lib/execinfo.c | 645 | lib/execinfo.c |
| 553 | lib/execinfo.in.h | 646 | lib/execinfo.in.h |
| 647 | lib/faccessat.c | ||
| 648 | lib/fcntl.in.h | ||
| 554 | lib/filemode.c | 649 | lib/filemode.c |
| 555 | lib/filemode.h | 650 | lib/filemode.h |
| 556 | lib/fpending.c | 651 | lib/fpending.c |
| 557 | lib/fpending.h | 652 | lib/fpending.h |
| 558 | lib/ftoastr.c | 653 | lib/ftoastr.c |
| 559 | lib/ftoastr.h | 654 | lib/ftoastr.h |
| 655 | lib/getgroups.c | ||
| 560 | lib/getloadavg.c | 656 | lib/getloadavg.c |
| 561 | lib/getopt.c | 657 | lib/getopt.c |
| 562 | lib/getopt.in.h | 658 | lib/getopt.in.h |
| @@ -565,6 +661,7 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 565 | lib/gettext.h | 661 | lib/gettext.h |
| 566 | lib/gettime.c | 662 | lib/gettime.c |
| 567 | lib/gettimeofday.c | 663 | lib/gettimeofday.c |
| 664 | lib/group-member.c | ||
| 568 | lib/ignore-value.h | 665 | lib/ignore-value.h |
| 569 | lib/intprops.h | 666 | lib/intprops.h |
| 570 | lib/inttypes.in.h | 667 | lib/inttypes.in.h |
| @@ -577,6 +674,7 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 577 | lib/pselect.c | 674 | lib/pselect.c |
| 578 | lib/pthread_sigmask.c | 675 | lib/pthread_sigmask.c |
| 579 | lib/readlink.c | 676 | lib/readlink.c |
| 677 | lib/root-uid.h | ||
| 580 | lib/sha1.c | 678 | lib/sha1.c |
| 581 | lib/sha1.h | 679 | lib/sha1.h |
| 582 | lib/sha256.c | 680 | lib/sha256.c |
| @@ -618,6 +716,7 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 618 | lib/utimens.c | 716 | lib/utimens.c |
| 619 | lib/utimens.h | 717 | lib/utimens.h |
| 620 | lib/verify.h | 718 | lib/verify.h |
| 719 | lib/xalloc-oversized.h | ||
| 621 | m4/00gnulib.m4 | 720 | m4/00gnulib.m4 |
| 622 | m4/alloca.m4 | 721 | m4/alloca.m4 |
| 623 | m4/c-strtod.m4 | 722 | m4/c-strtod.m4 |
| @@ -625,16 +724,22 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 625 | m4/close-stream.m4 | 724 | m4/close-stream.m4 |
| 626 | m4/dup2.m4 | 725 | m4/dup2.m4 |
| 627 | m4/environ.m4 | 726 | m4/environ.m4 |
| 727 | m4/euidaccess.m4 | ||
| 628 | m4/execinfo.m4 | 728 | m4/execinfo.m4 |
| 629 | m4/extensions.m4 | 729 | m4/extensions.m4 |
| 630 | m4/extern-inline.m4 | 730 | m4/extern-inline.m4 |
| 731 | m4/faccessat.m4 | ||
| 732 | m4/fcntl-o.m4 | ||
| 733 | m4/fcntl_h.m4 | ||
| 631 | m4/filemode.m4 | 734 | m4/filemode.m4 |
| 632 | m4/fpending.m4 | 735 | m4/fpending.m4 |
| 736 | m4/getgroups.m4 | ||
| 633 | m4/getloadavg.m4 | 737 | m4/getloadavg.m4 |
| 634 | m4/getopt.m4 | 738 | m4/getopt.m4 |
| 635 | m4/gettime.m4 | 739 | m4/gettime.m4 |
| 636 | m4/gettimeofday.m4 | 740 | m4/gettimeofday.m4 |
| 637 | m4/gnulib-common.m4 | 741 | m4/gnulib-common.m4 |
| 742 | m4/group-member.m4 | ||
| 638 | m4/include_next.m4 | 743 | m4/include_next.m4 |
| 639 | m4/inttypes.m4 | 744 | m4/inttypes.m4 |
| 640 | m4/largefile.m4 | 745 | m4/largefile.m4 |
diff --git a/m4/group-member.m4 b/m4/group-member.m4 new file mode 100644 index 00000000000..c393b5b1303 --- /dev/null +++ b/m4/group-member.m4 | |||
| @@ -0,0 +1,29 @@ | |||
| 1 | # serial 14 | ||
| 2 | |||
| 3 | # Copyright (C) 1999-2001, 2003-2007, 2009-2012 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | # This file is free software; the Free Software Foundation | ||
| 6 | # gives unlimited permission to copy and/or distribute it, | ||
| 7 | # with or without modifications, as long as this notice is preserved. | ||
| 8 | |||
| 9 | dnl Written by Jim Meyering | ||
| 10 | |||
| 11 | AC_DEFUN([gl_FUNC_GROUP_MEMBER], | ||
| 12 | [ | ||
| 13 | AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) | ||
| 14 | |||
| 15 | dnl Persuade glibc <unistd.h> to declare group_member(). | ||
| 16 | AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) | ||
| 17 | |||
| 18 | dnl Do this replacement check manually because I want the hyphen | ||
| 19 | dnl (not the underscore) in the filename. | ||
| 20 | AC_CHECK_FUNC([group_member], , [ | ||
| 21 | HAVE_GROUP_MEMBER=0 | ||
| 22 | ]) | ||
| 23 | ]) | ||
| 24 | |||
| 25 | # Prerequisites of lib/group-member.c. | ||
| 26 | AC_DEFUN([gl_PREREQ_GROUP_MEMBER], | ||
| 27 | [ | ||
| 28 | AC_REQUIRE([AC_FUNC_GETGROUPS]) | ||
| 29 | ]) | ||