0005-Use-configure-to-test-for-feature-instead-of-platfor.patch 2.8 KB
Newer Older
L
LEAN-ESX 已提交
1 2
--- a/configure.ac
+++ b/configure.ac
3
@@ -940,6 +940,7 @@ AC_CHECK_FUNCS(
L
LEAN-ESX 已提交
4 5 6 7 8 9 10
 
 AC_CHECK_FUNCS([ecvt])
 AC_CHECK_FUNCS([fcvt])
+AC_CHECK_FUNCS([getifaddrs getauxval issetugid __secure_getenv])
 
 AC_CHECK_FUNC([mkdtemp], [have_mkdtemp=yes])
 
11
@@ -1149,10 +1150,13 @@ fi
L
LEAN-ESX 已提交
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
 ###
 
 AC_CHECK_HEADERS([crypt.h])
+AC_CHECK_HEADERS([ifaddrs.h])
 AC_CHECK_HEADERS([inttypes.h])
 AC_CHECK_HEADERS([stdint.h])
 AC_CHECK_HEADERS([stdlib.h])
 AC_CHECK_HEADERS([wchar.h])
+AC_CHECK_HEADERS([net/if.h])
+AC_CHECK_HEADERS([sys/auxv.h])
 AC_CHECK_HEADERS([sys/inttypes.h])
 AC_CHECK_HEADERS([sys/io.h])
 AC_CHECK_HEADERS([sys/param.h]) # Required to make the sys/user.h check work correctly on FreeBSD
--- a/lib/misc/idLinux.c
+++ b/lib/misc/idLinux.c
@@ -27,12 +27,9 @@
 #include <sys/syscall.h>
 #include <string.h>
 #include <unistd.h>
-#ifdef __linux__
-#if defined(__GLIBC__) && \
-           (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 16))
+#ifdef HAVE_SYS_AUXV_H
 #include <sys/auxv.h>
 #endif
-#endif
 #ifdef __APPLE__
 #include <sys/socket.h>
 #include <TargetConditionals.h>
L
lean 已提交
41
@@ -1025,31 +1022,32 @@ Id_EndSuperUser(uid_t uid)  // IN:
L
LEAN-ESX 已提交
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
 static Bool
 IdIsSetUGid(void)
 {
-#if defined(__ANDROID__)
-   /* Android does not have a secure_getenv, so be conservative. */
-   return TRUE;
-#else
    /*
     * We use __secure_getenv, which returns NULL if the binary is
-    * setuid or setgid. Alternatives include,
+    * setuid or setgid, when issetugid or getauxval(AT_SECURE) is not
+    * available. Alternatives include,
     *
-    *   a) getauxval(AT_SECURE); not available until glibc 2.16.
-    *   b) __libc_enable_secure; may not be exported.
+    *   a) issetugid(); not (yet?) available in glibc.
+    *   b) getauxval(AT_SECURE); not available until glibc 2.16.
+    *   c) __libc_enable_secure; may not be exported.
     *
-    * Use (a) when we are based on glibc 2.16, or newer.
+    * Use (b) when we are based on glibc 2.16, or newer.
     */
 
-#if defined(__GLIBC__) && \
-           (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 16))
+#if HAVE_ISSETUGID
+   return issetugid();
+#elif HAVE_GETAUXVAL
    return getauxval(AT_SECURE) != 0;
-#else
+#elif HAVE___SECURE_GETENV
    static const char envName[] = "VMW_SETUGID_TEST";
 
    if (setenv(envName, "1", TRUE) == -1) {
       return TRUE; /* Conservative */
    }
    return __secure_getenv(envName) == NULL;
-#endif
+#else
+   /* Android does not have a secure_getenv, so be conservative. */
+   return TRUE;
 #endif
 }
 #endif
--- a/lib/nicInfo/nicInfoPosix.c
+++ b/lib/nicInfo/nicInfoPosix.c
H
hue715 已提交
88
@@ -35,9 +35,13 @@
L
LEAN-ESX 已提交
89 90
 #include <sys/stat.h>
 #include <errno.h>
H
hue715 已提交
91
 #include <limits.h>
L
LEAN-ESX 已提交
92 93 94 95 96 97 98 99 100 101 102
-#if defined(__FreeBSD__) || defined(__APPLE__)
+#if HAVE_SYS_SYSCTL_H
 # include <sys/sysctl.h>
+#endif
+#if HAVE_IFADDRS_H
 # include <ifaddrs.h>
+#endif
+#if HAVE_NET_IF_H
 # include <net/if.h>
 #endif
 #ifndef NO_DNET