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.

105 lines
2.9 KiB

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