mrc0mmand / rpms / openldap

Forked from rpms/openldap 3 years ago
Clone

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

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