You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

102 lines
2.8 KiB

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