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