- /* deref the base if needed */
- suffix_alias( be, &nbase );
-
-#ifdef LDAP_SLAPI
- attrs = anlist2charray( an );
- pb = initSearchPlugin( be, conn, op, &pbase,
- scope, deref, sizelimit,
- timelimit, filter, &fstr, attrs, attrsonly,
- manageDSAit );
- rc = doPreSearchPluginFNs( be, pb );
- if ( rc != LDAP_SUCCESS ) {
- goto return_results;
- }
-
- doSearchRewriteFNs( be, pb, &filter, &fstr );
-#endif /* LDAP_SLAPI */
-
- /* actually do the search and send the result(s) */
- if ( be->be_search ) {
- (*be->be_search)( be, conn, op, &pbase, &nbase,
- scope, deref, sizelimit,
- timelimit, filter, &fstr, an, attrsonly );
- } else {
- send_ldap_result( conn, op, rc = LDAP_UNWILLING_TO_PERFORM,
- NULL, "operation not supported within namingContext",
- NULL, NULL );
- }
-
-#ifdef LDAP_SLAPI
- doPostSearchPluginFNs( be, pb );
-#endif /* LDAP_SLAPI */
-
-return_results:;
-#ifdef LDAP_CLIENT_UPDATE
- if ( !( op->o_clientupdate_type & SLAP_LCUP_PERSIST ) )
-#endif /* LDAP_CLIENT_UPDATE */
- {
- if( pbase.bv_val != NULL) free( pbase.bv_val );
- if( nbase.bv_val != NULL) free( nbase.bv_val );
-
- if( fstr.bv_val != NULL) free( fstr.bv_val );
- if( filter != NULL) filter_free( filter );
- if( an != NULL ) free( an );
-#ifdef LDAP_SLAPI
- if( attrs != NULL) ch_free( attrs );
-#endif /* LDAP_SLAPI */
- }