1 |
vip-ire |
1.1 |
The non-reentrant gethostbyXXXX() functions deadlock if called recursively, for |
2 |
|
|
example if libldap needs to be initialized from within gethostbyXXXX() (which |
3 |
|
|
actually happens if nss_ldap is used for hostname resolution and earlier |
4 |
|
|
modules can't resolve the local host name), so use the reentrant versions of |
5 |
|
|
the functions, even if we're not being compiled for use in libldap_r |
6 |
|
|
|
7 |
|
|
Resolves: #179730 |
8 |
|
|
Author: Jeffery Layton <jlayton@redhat.com> |
9 |
|
|
|
10 |
|
|
diff --git a/libraries/libldap/util-int.c b/libraries/libldap/util-int.c |
11 |
|
|
index 373c81c..a012062 100644 |
12 |
|
|
--- a/libraries/libldap/util-int.c |
13 |
|
|
+++ b/libraries/libldap/util-int.c |
14 |
|
|
@@ -52,8 +52,8 @@ extern int h_errno; |
15 |
|
|
#ifndef LDAP_R_COMPILE |
16 |
|
|
# undef HAVE_REENTRANT_FUNCTIONS |
17 |
|
|
# undef HAVE_CTIME_R |
18 |
|
|
-# undef HAVE_GETHOSTBYNAME_R |
19 |
|
|
-# undef HAVE_GETHOSTBYADDR_R |
20 |
|
|
+/* # undef HAVE_GETHOSTBYNAME_R */ |
21 |
|
|
+/* # undef HAVE_GETHOSTBYADDR_R */ |
22 |
|
|
|
23 |
|
|
#else |
24 |
|
|
# include <ldap_pvt_thread.h> |
25 |
|
|
@@ -317,7 +317,7 @@ ldap_pvt_csnstr(char *buf, size_t len, unsigned int replica, unsigned int mod) |
26 |
|
|
#define BUFSTART (1024-32) |
27 |
|
|
#define BUFMAX (32*1024-32) |
28 |
|
|
|
29 |
|
|
-#if defined(LDAP_R_COMPILE) |
30 |
|
|
+#if defined(LDAP_R_COMPILE) || defined(HAVE_GETHOSTBYNAME_R) && defined(HAVE_GETHOSTBYADDR_R) |
31 |
|
|
static char *safe_realloc( char **buf, int len ); |
32 |
|
|
|
33 |
|
|
#if !(defined(HAVE_GETHOSTBYNAME_R) && defined(HAVE_GETHOSTBYADDR_R)) |