mrc0mmand / rpms / openldap

Forked from rpms/openldap 3 years ago
Clone

Blame SOURCES/openldap-reentrant-gethostby.patch

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