CLDAP ldap_result hangs if nobody listens on the port

Resolves: #1877754
This commit is contained in:
Simon Pichugin 2020-09-10 13:14:49 +02:00
parent c0e9e1a02c
commit be11dedffb
2 changed files with 47 additions and 1 deletions

View File

@ -0,0 +1,41 @@
From ec5eba5393e5cc65b05e54658c55500cdbff775a Mon Sep 17 00:00:00 2001
From: Howard Chu <hyc@openldap.org>
Date: Wed, 26 Aug 2020 13:22:52 +0100
Subject: [PATCH 01/34] ITS#9328 cldap: check for error on connected socket
libldap doesn't use a connected socket for UDP sessions, but 3rd
parties can, passed in with ldap_init_fd().
---
libraries/libldap/result.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/libraries/libldap/result.c b/libraries/libldap/result.c
index bdced135b..e2b220630 100644
--- a/libraries/libldap/result.c
+++ b/libraries/libldap/result.c
@@ -486,7 +486,8 @@ retry:
#ifdef LDAP_CONNECTIONLESS
if ( LDAP_IS_UDP(ld) ) {
struct sockaddr_storage from;
- ber_int_sb_read( lc->lconn_sb, &from, sizeof(struct sockaddr_storage) );
+ if ( ber_int_sb_read( lc->lconn_sb, &from, sizeof(struct sockaddr_storage) ) < 0 )
+ goto fail;
if ( ld->ld_options.ldo_version == LDAP_VERSION2 ) isv2 = 1;
}
nextresp3:
@@ -502,10 +503,11 @@ nextresp3:
break;
case LBER_DEFAULT:
+fail:
err = sock_errno();
#ifdef LDAP_DEBUG
Debug( LDAP_DEBUG_CONNS,
- "ber_get_next failed.\n", 0, 0, 0 );
+ "ber_get_next failed, errno=%d.\n", err, 0, 0 );
#endif
if ( err == EWOULDBLOCK ) return LDAP_MSG_X_KEEP_LOOKING;
if ( err == EAGAIN ) return LDAP_MSG_X_KEEP_LOOKING;
--
2.26.2

View File

@ -5,7 +5,7 @@
Name: openldap
Version: 2.4.50
Release: 4%{?dist}
Release: 5%{?dist}
Summary: LDAP support libraries
License: OpenLDAP
URL: http://www.openldap.org/
@ -26,6 +26,7 @@ Patch2: openldap-reentrant-gethostby.patch
Patch3: openldap-smbk5pwd-overlay.patch
Patch5: openldap-ai-addrconfig.patch
Patch17: openldap-allop-overlay.patch
Patch18: openldap-cldap-check-for-error-on-connected-socket.patch
# fix back_perl problems with lt_dlopen()
# might cause crashes because of symbol collisions
@ -109,6 +110,7 @@ AUTOMAKE=%{_bindir}/true autoreconf -fi
%patch3 -p1
%patch5 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1
%patch24 -p1
%patch25 -p1
@ -481,6 +483,9 @@ exit 0
%{_mandir}/man3/*
%changelog
* Thu Sep 10 2020 Simon Pichugin <spichugi@redhat.com> - 2.4.50-5
- CLDAP ldap_result hangs if nobody listens on the port (#1877754)
* Sat Aug 01 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.4.50-4
- Second attempt - Rebuilt for
https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild