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