]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#9328 cldap: check for error on connected socket
authorHoward Chu <hyc@openldap.org>
Wed, 26 Aug 2020 12:22:52 +0000 (13:22 +0100)
committerQuanah Gibson-Mount <quanah@openldap.org>
Wed, 26 Aug 2020 20:53:38 +0000 (20:53 +0000)
libldap doesn't use a connected socket for UDP sessions, but 3rd
parties can, passed in with ldap_init_fd().

libraries/libldap/result.c

index 04ee48ea188f006810877bb7134aae8b9bb8f365..88876eae66ba9a8e2b3ac4371000868f32e84886 100644 (file)
@@ -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                 
-               Debug0( LDAP_DEBUG_CONNS,
-                       "ber_get_next failed.\n" );
+               Debug1( LDAP_DEBUG_CONNS,
+                       "ber_get_next failed, errno=%d.\n", err );
 #endif            
                if ( err == EWOULDBLOCK ) return LDAP_MSG_X_KEEP_LOOKING;
                if ( err == EAGAIN ) return LDAP_MSG_X_KEEP_LOOKING;