[glib: 1/3] Remove unused HAVE_LIBC_ENABLE_SECURE



commit 41165b2a7e5e73daa7555486a90ccfa300160906
Author: Christoph Reiter <reiter christoph gmail com>
Date:   Thu May 31 10:40:21 2018 +0200

    Remove unused HAVE_LIBC_ENABLE_SECURE
    
    It was added in 4c2928a544829 to potentially enable accessing
    AT_SECURE through __libc_enable_secure, but was never enabled.
    
    Newer glibc provides getauxval(AT_SECURE) which should be used instead.
    Add a TODO note for that.

 config.h.meson    |  3 ---
 config.h.win32.in |  3 ---
 configure.ac      | 11 -----------
 glib/gutils.c     | 17 ++++-------------
 4 files changed, 4 insertions(+), 30 deletions(-)
---
diff --git a/config.h.meson b/config.h.meson
index fd0bfcaf9..5752751ed 100644
--- a/config.h.meson
+++ b/config.h.meson
@@ -250,9 +250,6 @@
 /* Define if your <locale.h> file defines LC_MESSAGES. */
 #mesondefine HAVE_LC_MESSAGES
 
-/* Define if you have the __libc_enable_secure variable (GNU libc, eglibc) */
-#mesondefine HAVE_LIBC_ENABLE_SECURE
-
 /* Define if libelf is available */
 #mesondefine HAVE_LIBELF
 
diff --git a/config.h.win32.in b/config.h.win32.in
index 14ac11d39..e8631ca02 100644
--- a/config.h.win32.in
+++ b/config.h.win32.in
@@ -254,9 +254,6 @@
 /* Define if your <locale.h> file defines LC_MESSAGES. */
 /* #undef HAVE_LC_MESSAGES */
 
-/* Define if you have the __libc_enable_secure variable (GNU libc, eglibc) */
-/* #undef HAVE_LIBC_ENABLE_SECURE */
-
 /* Define if libelf is available */
 /* #undef HAVE_LIBELF */
 
diff --git a/configure.ac b/configure.ac
index be48c9a19..18752b264 100644
--- a/configure.ac
+++ b/configure.ac
@@ -506,17 +506,6 @@ AC_CHECK_FUNCS(mmap posix_memalign memalign valloc fsync pipe2 issetugid)
 AC_CHECK_FUNCS(timegm gmtime_r)
 AC_FUNC_STRERROR_R()
 
-AC_CACHE_CHECK([for __libc_enable_secure], glib_cv_have_libc_enable_secure,
-  [AC_TRY_LINK([#include <unistd.h>
-    extern int __libc_enable_secure;],
-    [return __libc_enable_secure;],
-   glib_cv_have_libc_enable_secure=yes,
-   glib_cv_have_libc_enable_secure=no)])
-AS_IF([test x$glib_cv_have_libc_enable_secure = xyes], [
-   AC_DEFINE(HAVE_LIBC_ENABLE_SECURE, 1,
-     [Define if you have the __libc_enable_secure variable (GNU libc, eglibc)])
-])
-
 AC_CHECK_SIZEOF(char)
 AC_CHECK_SIZEOF(short)
 AC_CHECK_SIZEOF(long)
diff --git a/glib/gutils.c b/glib/gutils.c
index 5813b2281..5527a402c 100644
--- a/glib/gutils.c
+++ b/glib/gutils.c
@@ -2495,23 +2495,14 @@ const gchar *g_get_tmp_dir_utf8 (void) { return g_get_tmp_dir (); }
 
 /* Private API:
  *
- * Returns %TRUE if the current process was executed as setuid (or an
- * equivalent __libc_enable_secure is available).  See:
- * http://osdir.com/ml/linux.lfs.hardened/2007-04/msg00032.html
+ * Returns %TRUE if the current process was executed as setuid
  */ 
 gboolean
 g_check_setuid (void)
 {
-  /* TODO: get __libc_enable_secure exported from glibc.
-   * See http://www.openwall.com/lists/owl-dev/2012/08/14/1
-   */
-#if 0 && defined(HAVE_LIBC_ENABLE_SECURE)
-  {
-    /* See glibc/include/unistd.h */
-    extern int __libc_enable_secure;
-    return __libc_enable_secure;
-  }
-#elif defined(HAVE_ISSETUGID) && !defined(__BIONIC__)
+/* TODO: use getauxval(AT_SECURE) if available */
+
+#if defined(HAVE_ISSETUGID) && !defined(__BIONIC__)
   /* BSD: http://www.freebsd.org/cgi/man.cgi?query=issetugid&sektion=2 */
 
   /* Android had it in older versions but the new 64 bit ABI does not


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]