1
0
forked from pool/openldap2

- Introduce patch 0009-Fix-ldap-host-lookup-ipv6.patch

and openldap-2.3.37-Fix-ldap-host-lookup-ipv6.patch
  to fix an issue with unresponsive LDAP host lookups in IPv6 environment.
  (bsc#955210)

OBS-URL: https://build.opensuse.org/package/show/network:ldap/openldap2?expand=0&rev=141
This commit is contained in:
Howard Guo 2015-11-30 10:24:53 +00:00 committed by Git OBS Bridge
parent c27bdaf3ec
commit 852740c235
4 changed files with 85 additions and 0 deletions

View File

@ -0,0 +1,73 @@
The patch was written by Christian Kornacker on 2014-01-08 to fix an issue with unresponsive
LDAP host lookups in IPv6 environment.
---
libraries/libldap/util-int.c | 39 +++++++++++++++++++++++++++++++++++++--
1 file changed, 37 insertions(+), 2 deletions(-)
Index: openldap-2.4.41/libraries/libldap/util-int.c
===================================================================
--- openldap-2.4.41.orig/libraries/libldap/util-int.c
+++ openldap-2.4.41/libraries/libldap/util-int.c
@@ -731,10 +731,16 @@ static char *safe_realloc( char **buf, i
char * ldap_pvt_get_fqdn( char *name )
{
- char *fqdn, *ha_buf;
+ int rc;
+ char *fqdn;
char hostbuf[MAXHOSTNAMELEN+1];
+#ifdef HAVE_GETADDRINFO
+ struct addrinfo hints, *res;
+#else
+ char *ha_buf;
struct hostent *hp, he_buf;
- int rc, local_h_errno;
+ int local_h_errno;
+#endif
if( name == NULL ) {
if( gethostname( hostbuf, MAXHOSTNAMELEN ) == 0 ) {
@@ -745,6 +751,33 @@ char * ldap_pvt_get_fqdn( char *name )
}
}
+#ifdef HAVE_GETADDRINFO
+ memset( &hints, '\0', sizeof( hints ) );
+ hints.ai_family = AF_UNSPEC;
+ hints.ai_socktype = SOCK_STREAM;
+ hints.ai_flags |= AI_CANONNAME;
+
+ /* most getaddrinfo(3) use non-threadsafe resolver libraries */
+ LDAP_MUTEX_LOCK(&ldap_int_resolv_mutex);
+
+ rc = getaddrinfo( name, NULL, &hints, &res );
+
+ LDAP_MUTEX_UNLOCK(&ldap_int_resolv_mutex);
+
+ if ( rc != 0 ) {
+ fqdn = LDAP_STRDUP( name );
+ } else {
+ while ( res ) {
+ if ( res->ai_canonname ) {
+ fqdn = LDAP_STRDUP ( res->ai_canonname );
+ break;
+ }
+ res = res->ai_next;
+ }
+ freeaddrinfo( res );
+ }
+#else
+
rc = ldap_pvt_gethostbyname_a( name,
&he_buf, &ha_buf, &hp, &local_h_errno );
@@ -755,6 +788,8 @@ char * ldap_pvt_get_fqdn( char *name )
}
LDAP_FREE( ha_buf );
+#endif
+
return fqdn;
}

View File

@ -46,6 +46,7 @@ Patch5: 0005-pie-compile.dif
Patch6: 0006-No-Build-date-and-time-in-binaries.dif Patch6: 0006-No-Build-date-and-time-in-binaries.dif
Patch7: 0007-Recover-on-DB-version-change.dif Patch7: 0007-Recover-on-DB-version-change.dif
Patch8: 0008-In-monitor-backend-do-not-return-Connection0-entries.patch Patch8: 0008-In-monitor-backend-do-not-return-Connection0-entries.patch
Patch9: 0009-Fix-ldap-host-lookup-ipv6.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: cyrus-sasl-devel BuildRequires: cyrus-sasl-devel
BuildRequires: groff BuildRequires: groff
@ -177,6 +178,7 @@ This package contains the OpenLDAP client libraries.
%patch6 -p1 %patch6 -p1
%patch7 -p1 %patch7 -p1
%patch8 -p1 %patch8 -p1
%patch9 -p1
cp %{SOURCE5} . cp %{SOURCE5} .
%build %build

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Mon Nov 30 10:16:57 UTC 2015 - hguo@suse.com
- Introduce patch 0009-Fix-ldap-host-lookup-ipv6.patch
and openldap-2.3.37-Fix-ldap-host-lookup-ipv6.patch
to fix an issue with unresponsive LDAP host lookups in IPv6 environment.
(bsc#955210)
------------------------------------------------------------------- -------------------------------------------------------------------
Fri Oct 9 09:19:35 UTC 2015 - hguo@suse.com Fri Oct 9 09:19:35 UTC 2015 - hguo@suse.com

View File

@ -46,6 +46,7 @@ Patch5: 0005-pie-compile.dif
Patch6: 0006-No-Build-date-and-time-in-binaries.dif Patch6: 0006-No-Build-date-and-time-in-binaries.dif
Patch7: 0007-Recover-on-DB-version-change.dif Patch7: 0007-Recover-on-DB-version-change.dif
Patch8: 0008-In-monitor-backend-do-not-return-Connection0-entries.patch Patch8: 0008-In-monitor-backend-do-not-return-Connection0-entries.patch
Patch9: 0009-Fix-ldap-host-lookup-ipv6.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: cyrus-sasl-devel BuildRequires: cyrus-sasl-devel
BuildRequires: groff BuildRequires: groff
@ -177,6 +178,7 @@ This package contains the OpenLDAP client libraries.
%patch6 -p1 %patch6 -p1
%patch7 -p1 %patch7 -p1
%patch8 -p1 %patch8 -p1
%patch9 -p1
cp %{SOURCE5} . cp %{SOURCE5} .
%build %build