Blame SOURCES/openldap-cldap-check-for-error-on-connected-socket.patch

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