openldap-reentrant-gethostby.patch 1.3 KB

12345678910111213141516171819202122232425262728293031323334
  1. The non-reentrant gethostbyXXXX() functions deadlock if called recursively, for
  2. example if libldap needs to be initialized from within gethostbyXXXX() (which
  3. actually happens if nss_ldap is used for hostname resolution and earlier
  4. modules can't resolve the local host name), so use the reentrant versions of
  5. the functions, even if we're not being compiled for use in libldap_r
  6. Resolves: #179730
  7. Author: Jeffery Layton <jlayton@redhat.com>
  8. diff --git a/libraries/libldap/util-int.c b/libraries/libldap/util-int.c
  9. index 373c81c..a012062 100644
  10. --- a/libraries/libldap/util-int.c
  11. +++ b/libraries/libldap/util-int.c
  12. @@ -52,8 +52,8 @@ extern int h_errno;
  13. #ifndef LDAP_R_COMPILE
  14. # undef HAVE_REENTRANT_FUNCTIONS
  15. # undef HAVE_CTIME_R
  16. -# undef HAVE_GETHOSTBYNAME_R
  17. -# undef HAVE_GETHOSTBYADDR_R
  18. +/* # undef HAVE_GETHOSTBYNAME_R */
  19. +/* # undef HAVE_GETHOSTBYADDR_R */
  20. #else
  21. # include <ldap_pvt_thread.h>
  22. @@ -317,7 +317,7 @@ ldap_pvt_csnstr(char *buf, size_t len, unsigned int replica, unsigned int mod)
  23. #define BUFSTART (1024-32)
  24. #define BUFMAX (32*1024-32)
  25. -#if defined(LDAP_R_COMPILE)
  26. +#if defined(LDAP_R_COMPILE) || defined(HAVE_GETHOSTBYNAME_R) && defined(HAVE_GETHOSTBYADDR_R)
  27. static char *safe_realloc( char **buf, int len );
  28. #if !(defined(HAVE_GETHOSTBYNAME_R) && defined(HAVE_GETHOSTBYADDR_R))