From: Howard Chu Date: Fri, 8 Jun 2007 09:40:17 +0000 (+0000) Subject: ITS#4992 fix cldap X-Git-Tag: OPENLDAP_REL_ENG_2_4_MP~415 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=469a45a62f0e4e5c76642fc50ff8b38210bed5eb;p=openldap ITS#4992 fix cldap --- diff --git a/libraries/libldap/abandon.c b/libraries/libldap/abandon.c index 43e2f342c8..d72483ecda 100644 --- a/libraries/libldap/abandon.c +++ b/libraries/libldap/abandon.c @@ -224,8 +224,9 @@ start_again:; i = ++(ld)->ld_msgid; #ifdef LDAP_CONNECTIONLESS if ( LDAP_IS_UDP(ld) ) { - err = ber_write( ber, ld->ld_options.ldo_peer, - sizeof(struct sockaddr), 0); + struct sockaddr sa = {0}; + /* dummy, filled with ldo_peer in request.c */ + err = ber_write( ber, &sa, sizeof(sa), 0 ); } if ( LDAP_IS_UDP(ld) && ld->ld_options.ldo_version == LDAP_VERSION2 ) diff --git a/libraries/libldap/request.c b/libraries/libldap/request.c index 6ecdcf6770..be36b19845 100644 --- a/libraries/libldap/request.c +++ b/libraries/libldap/request.c @@ -255,6 +255,19 @@ ldap_send_server_request( use_connection( ld, lc ); +#ifdef LDAP_CONNECTIONLESS + if ( LDAP_IS_UDP( ld )) { + BerElement tmpber = *ber; + ber_rewind( &tmpber ); + rc = ber_write( &tmpber, ld->ld_options.ldo_peer, + sizeof( struct sockaddr ), 0 ); + if ( rc == -1 ) { + ld->ld_errno = LDAP_ENCODING_ERROR; + return rc; + } + } +#endif + /* If we still have an incomplete write, try to finish it before * dealing with the new request. If we don't finish here, return * LDAP_BUSY and let the caller retry later. We only allow a single diff --git a/libraries/libldap/search.c b/libraries/libldap/search.c index a09b8301ca..2f27eddd6e 100644 --- a/libraries/libldap/search.c +++ b/libraries/libldap/search.c @@ -259,8 +259,9 @@ ldap_build_search_req( LDAP_NEXT_MSGID( ld, *idp ); #ifdef LDAP_CONNECTIONLESS if ( LDAP_IS_UDP(ld) ) { - err = ber_write( ber, ld->ld_options.ldo_peer, - sizeof(struct sockaddr), 0); + struct sockaddr sa = {0}; + /* dummy, filled with ldo_peer in request.c */ + err = ber_write( ber, &sa, sizeof( sa ), 0 ); } if ( LDAP_IS_UDP(ld) && ld->ld_options.ldo_version == LDAP_VERSION2) { char *dn = ld->ld_options.ldo_cldapdn;