From: Howard Chu Date: Fri, 8 Jun 2007 09:43:26 +0000 (+0000) Subject: ITS#4992 cldap fix from HEAD X-Git-Tag: OPENLDAP_REL_ENG_2_3_36~27 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5d5363fec88830c52d7b9e054af5e5b3cf613cae;p=thirdparty%2Fopenldap.git ITS#4992 cldap fix from HEAD --- diff --git a/libraries/libldap/abandon.c b/libraries/libldap/abandon.c index a6117d859b..0ff1871c26 100644 --- a/libraries/libldap/abandon.c +++ b/libraries/libldap/abandon.c @@ -191,8 +191,9 @@ do_abandon( 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 07f10ae501..c147c2529a 100644 --- a/libraries/libldap/request.c +++ b/libraries/libldap/request.c @@ -222,6 +222,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 ce9cdbae9f..2fc0f4b8b5 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;