openldap/openldap-reentrant-gethostby.patch
Simon Pichugin 004e302f0d Update to new major release OpenLDAP 2.6.1
- rediff all patches and remove patches now upstream
- use upstream source location for check password module
  and rediff patch due to this
- add patch to fix build issue in 2.5.4 (from upstream)
- clean and sort buildreqs
- remove various refs to bdb
- remove now default -DLDAP_USE_NON_BLOCKING_TLS
- add new modules and enable load balancer as module
- disable wiredtired backend due to missing build deps
- don't remove files that don't exist
- let check-config work on *.mdb over legacy files
- remove refs to old-style config
- new soname names
- remove libldap_r link as the library was merged with libldap
- refactor openldap-compat package to support the transition from 2.4
- add UPGRADE_INSTRUCTIONS for openldap-server upgrade

The original patch was submitted by Fedora user - terjeros
https://src.fedoraproject.org/rpms/openldap/pull-request/6

Resolves: #1955293
2022-01-31 14:59:38 -08:00

34 lines
1.3 KiB
Diff

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