X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=libraries%2Flibldap%2Fsearch.c;h=50f50067ff92dfe2d6d32fcd46f9226367758429;hb=a2eec74fc1d535fa9092f4d7b82a669b39eef539;hp=5adb5b8ed2d7aa976264eb91664b6c5df1d1f745;hpb=f61152ccbd54573573f27dba8f94e88dd2f41f61;p=openldap diff --git a/libraries/libldap/search.c b/libraries/libldap/search.c index 5adb5b8ed2..50f50067ff 100644 --- a/libraries/libldap/search.c +++ b/libraries/libldap/search.c @@ -297,11 +297,28 @@ ldap_build_search_req( } } - err = ber_printf( ber, "{it{seeiib", ++ld->ld_msgid, +#ifdef LDAP_CONNECTIONLESS + if ( LDAP_IS_UDP(ld) ) { + err = ber_write( ber, ld->ld_options.ldo_peer, + sizeof(struct sockaddr), 0); + } + if ( LDAP_IS_UDP(ld) && ld->ld_options.ldo_version == LDAP_VERSION2) { + char *dn = ld->ld_options.ldo_cldapdn; + if (!dn) dn = ""; + err = ber_printf( ber, "{ist{seeiib", ++ld->ld_msgid, dn, + LDAP_REQ_SEARCH, base, (ber_int_t) scope, ld->ld_deref, + (sizelimit < 0) ? ld->ld_sizelimit : sizelimit, + (timelimit < 0) ? ld->ld_timelimit : timelimit, + attrsonly ); + } else +#endif + { + err = ber_printf( ber, "{it{seeiib", ++ld->ld_msgid, LDAP_REQ_SEARCH, base, (ber_int_t) scope, ld->ld_deref, (sizelimit < 0) ? ld->ld_sizelimit : sizelimit, (timelimit < 0) ? ld->ld_timelimit : timelimit, attrsonly ); + } if ( err == -1 ) { ld->ld_errno = LDAP_ENCODING_ERROR;