mrc0mmand / rpms / openldap

Forked from rpms/openldap 3 years ago
Clone

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

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