Blame SOURCES/openldap-reentrant-gethostby.patch

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