mrc0mmand / rpms / openldap

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