Blame SOURCES/openldap-reentrant-gethostby.patch

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