X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=libraries%2Flibldap%2Fsearch.c;h=50f50067ff92dfe2d6d32fcd46f9226367758429;hb=a2eec74fc1d535fa9092f4d7b82a669b39eef539;hp=2d2071030261cf7545a8e2f6dfd624717a169639;hpb=3498151f9914a2faee6ed34648690d8672be8506;p=openldap diff --git a/libraries/libldap/search.c b/libraries/libldap/search.c index 2d20710302..50f50067ff 100644 --- a/libraries/libldap/search.c +++ b/libraries/libldap/search.c @@ -91,6 +91,7 @@ ldap_search_ext( int sizelimit, int *msgidp ) { + int rc; BerElement *ber; int timelimit; @@ -99,6 +100,10 @@ ldap_search_ext( assert( ld != NULL ); assert( LDAP_VALID( ld ) ); + /* check client controls */ + rc = ldap_int_client_controls( ld, cctrls ); + if( rc != LDAP_SUCCESS ) return rc; + /* * if timeout is provided, both tv_sec and tv_usec must * be non-zero @@ -292,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;