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