]> git.sur5r.net Git - openldap/blob - servers/slapd/search.c
6f0d30e18e8501bab69292177b22f7cd2684b8c9
[openldap] / servers / slapd / search.c
1 /* $OpenLDAP$ */
2 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
3  *
4  * Copyright 1998-2004 The OpenLDAP Foundation.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted only as authorized by the OpenLDAP
9  * Public License.
10  *
11  * A copy of this license is available in the file LICENSE in the
12  * top-level directory of the distribution or, alternatively, at
13  * <http://www.OpenLDAP.org/license.html>.
14  */
15 /* Portions Copyright (c) 1995 Regents of the University of Michigan.
16  * All rights reserved.
17  *
18  * Redistribution and use in source and binary forms are permitted
19  * provided that this notice is preserved and that due credit is given
20  * to the University of Michigan at Ann Arbor. The name of the University
21  * may not be used to endorse or promote products derived from this
22  * software without specific prior written permission. This software
23  * is provided ``as is'' without express or implied warranty.
24  */
25
26 #include "portable.h"
27
28 #include <stdio.h>
29
30 #include <ac/string.h>
31 #include <ac/socket.h>
32
33 #include "ldap_pvt.h"
34 #include "lutil.h"
35 #include "slap.h"
36
37 #ifdef LDAP_SLAPI
38 #include "slapi/slapi.h"
39
40 static char **anlist2charray( Operation *op, AttributeName *an );
41 static void init_search_pblock( Operation *op, char **attrs, int managedsait );
42 static int call_search_preop_plugins( Operation *op );
43 static int call_search_rewrite_plugins( Operation *op );
44 static void call_search_postop_plugins( Operation *op );
45 #endif /* LDAPI_SLAPI */
46
47 int
48 do_search(
49     Operation   *op,    /* info about the op to which we're responding */
50     SlapReply   *rs     /* all the response data we'll send */ )
51 {
52         struct berval base = BER_BVNULL;
53         ber_len_t       siz, off, i;
54         int                     manageDSAit;
55         int                     be_manageDSAit;
56 #ifdef LDAP_SLAPI
57         char            **attrs = NULL;
58 #endif
59
60 #ifdef NEW_LOGGING
61         LDAP_LOG( OPERATION, ENTRY, "do_search: conn %d\n", op->o_connid, 0, 0 );
62 #else
63         Debug( LDAP_DEBUG_TRACE, "do_search\n", 0, 0, 0 );
64 #endif
65
66         /*
67          * Parse the search request.  It looks like this:
68          *
69          *      SearchRequest := [APPLICATION 3] SEQUENCE {
70          *              baseObject      DistinguishedName,
71          *              scope           ENUMERATED {
72          *                      baseObject      (0),
73          *                      singleLevel     (1),
74          *                      wholeSubtree (2),
75          *          subordinate (3)  -- OpenLDAP extension
76          *              },
77          *              derefAliases    ENUMERATED {
78          *                      neverDerefaliases       (0),
79          *                      derefInSearching        (1),
80          *                      derefFindingBaseObj     (2),
81          *                      alwaysDerefAliases      (3)
82          *              },
83          *              sizelimit       INTEGER (0 .. 65535),
84          *              timelimit       INTEGER (0 .. 65535),
85          *              attrsOnly       BOOLEAN,
86          *              filter          Filter,
87          *              attributes      SEQUENCE OF AttributeType
88          *      }
89          */
90
91         /* baseObject, scope, derefAliases, sizelimit, timelimit, attrsOnly */
92         if ( ber_scanf( op->o_ber, "{miiiib" /*}*/,
93                 &base, &op->ors_scope, &op->ors_deref, &op->ors_slimit,
94             &op->ors_tlimit, &op->ors_attrsonly ) == LBER_ERROR )
95         {
96                 send_ldap_discon( op, rs, LDAP_PROTOCOL_ERROR, "decoding error" );
97                 rs->sr_err = SLAPD_DISCONNECT;
98                 goto return_results;
99         }
100
101         if ( op->ors_tlimit < 0 || op->ors_tlimit > SLAP_MAX_LIMIT ) {
102                 send_ldap_error( op, rs, LDAP_PROTOCOL_ERROR, "invalid time limit" );
103                 goto return_results;
104         }
105
106         if ( op->ors_slimit < 0 || op->ors_slimit > SLAP_MAX_LIMIT ) {
107                 send_ldap_error( op, rs, LDAP_PROTOCOL_ERROR, "invalid size limit" );
108                 goto return_results;
109         }
110
111         switch( op->ors_scope ) {
112         case LDAP_SCOPE_BASE:
113         case LDAP_SCOPE_ONELEVEL:
114         case LDAP_SCOPE_SUBTREE:
115 #ifdef LDAP_SCOPE_SUBORDINATE
116         case LDAP_SCOPE_SUBORDINATE:
117 #endif
118                 break;
119         default:
120                 send_ldap_error( op, rs, LDAP_PROTOCOL_ERROR, "invalid scope" );
121                 goto return_results;
122         }
123
124         switch( op->ors_deref ) {
125         case LDAP_DEREF_NEVER:
126         case LDAP_DEREF_FINDING:
127         case LDAP_DEREF_SEARCHING:
128         case LDAP_DEREF_ALWAYS:
129                 break;
130         default:
131                 send_ldap_error( op, rs, LDAP_PROTOCOL_ERROR, "invalid deref" );
132                 goto return_results;
133         }
134
135         rs->sr_err = dnPrettyNormal( NULL, &base, &op->o_req_dn, &op->o_req_ndn, op->o_tmpmemctx );
136         if( rs->sr_err != LDAP_SUCCESS ) {
137 #ifdef NEW_LOGGING
138                 LDAP_LOG( OPERATION, ERR, 
139                         "do_search: conn %d  invalid dn (%s)\n",
140                         op->o_connid, base.bv_val, 0 );
141 #else
142                 Debug( LDAP_DEBUG_ANY,
143                         "do_search: invalid dn (%s)\n", base.bv_val, 0, 0 );
144 #endif
145                 send_ldap_error( op, rs, LDAP_INVALID_DN_SYNTAX, "invalid DN" );
146                 goto return_results;
147         }
148
149 #ifdef NEW_LOGGING
150         LDAP_LOG( OPERATION, ARGS, "SRCH \"%s\" %d %d",
151                 base.bv_val, op->ors_scope, op->ors_deref );
152         LDAP_LOG( OPERATION, ARGS, "    %d %d %d\n",
153                 op->ors_slimit, op->ors_tlimit, op->ors_attrsonly);
154 #else
155         Debug( LDAP_DEBUG_ARGS, "SRCH \"%s\" %d %d",
156                 base.bv_val, op->ors_scope, op->ors_deref );
157         Debug( LDAP_DEBUG_ARGS, "    %d %d %d\n",
158                 op->ors_slimit, op->ors_tlimit, op->ors_attrsonly);
159 #endif
160
161         /* filter - returns a "normalized" version */
162         rs->sr_err = get_filter( op, op->o_ber, &op->ors_filter, &rs->sr_text );
163         if( rs->sr_err != LDAP_SUCCESS ) {
164                 if( rs->sr_err == SLAPD_DISCONNECT ) {
165                         rs->sr_err = LDAP_PROTOCOL_ERROR;
166                         send_ldap_disconnect( op, rs );
167                         rs->sr_err = SLAPD_DISCONNECT;
168                 } else {
169                         send_ldap_result( op, rs );
170                 }
171                 goto return_results;
172         }
173         filter2bv_x( op, op->ors_filter, &op->ors_filterstr );
174
175 #ifdef NEW_LOGGING
176         LDAP_LOG( OPERATION, ARGS, 
177                 "do_search: conn %d     filter: %s\n", 
178                 op->o_connid, !BER_BVISEMPTY( &op->ors_filterstr ) ? op->ors_filterstr.bv_val : "empty",
179                 0 );
180 #else
181         Debug( LDAP_DEBUG_ARGS, "    filter: %s\n",
182                 !BER_BVISEMPTY( &op->ors_filterstr ) ? op->ors_filterstr.bv_val : "empty", 0, 0 );
183 #endif
184
185         /* attributes */
186         siz = sizeof(AttributeName);
187         off = offsetof(AttributeName,an_name);
188         if ( ber_scanf( op->o_ber, "{M}}", &op->ors_attrs, &siz, off ) == LBER_ERROR ) {
189                 send_ldap_discon( op, rs, LDAP_PROTOCOL_ERROR, "decoding attrs error" );
190                 rs->sr_err = SLAPD_DISCONNECT;
191                 goto return_results;
192         }
193         for ( i=0; i<siz; i++ ) {
194                 const char *dummy;      /* ignore msgs from bv2ad */
195                 op->ors_attrs[i].an_desc = NULL;
196                 op->ors_attrs[i].an_oc = NULL;
197                 op->ors_attrs[i].an_oc_exclude = 0;
198                 slap_bv2ad(&op->ors_attrs[i].an_name, &op->ors_attrs[i].an_desc, &dummy);
199         }
200
201         if( get_ctrls( op, rs, 1 ) != LDAP_SUCCESS ) {
202 #ifdef NEW_LOGGING
203                 LDAP_LOG( OPERATION, INFO, 
204                         "do_search: conn %d  get_ctrls failed (%d)\n",
205                         op->o_connid, rs->sr_err, 0 );
206 #else
207                 Debug( LDAP_DEBUG_ANY, "do_search: get_ctrls failed\n", 0, 0, 0 );
208 #endif
209
210                 goto return_results;
211         }
212
213 #ifdef NEW_LOGGING
214         LDAP_LOG( OPERATION, ARGS, 
215                 "do_search: conn %d     attrs:", op->o_connid, 0, 0 );
216 #else
217         Debug( LDAP_DEBUG_ARGS, "    attrs:", 0, 0, 0 );
218 #endif
219
220         if ( siz != 0 ) {
221                 for ( i = 0; i<siz; i++ ) {
222 #ifdef NEW_LOGGING
223                         LDAP_LOG( OPERATION, ARGS, 
224                                 "do_search: %s", op->ors_attrs[i].an_name.bv_val, 0, 0 );
225 #else
226                         Debug( LDAP_DEBUG_ARGS, " %s", op->ors_attrs[i].an_name.bv_val, 0, 0 );
227 #endif
228                 }
229         }
230
231 #ifdef NEW_LOGGING
232         LDAP_LOG( OPERATION, ARGS, "\n" , 0, 0, 0 );
233 #else
234         Debug( LDAP_DEBUG_ARGS, "\n", 0, 0, 0 );
235 #endif
236
237         if ( StatslogTest( LDAP_DEBUG_STATS ) ) {
238                 char abuf[BUFSIZ/2], *ptr = abuf;
239                 int len = 0, alen;
240
241                 sprintf(abuf, "scope=%d deref=%d", op->ors_scope, op->ors_deref);
242                 Statslog( LDAP_DEBUG_STATS,
243                         "conn=%lu op=%lu SRCH base=\"%s\" %s filter=\"%s\"\n",
244                         op->o_connid, op->o_opid, op->o_req_dn.bv_val, abuf,
245                         op->ors_filterstr.bv_val );
246
247                 for ( i = 0; i<siz; i++ ) {
248                         alen = op->ors_attrs[i].an_name.bv_len;
249                         if (alen >= sizeof(abuf)) {
250                                 alen = sizeof(abuf)-1;
251                         }
252                         if (len && (len + 1 + alen >= sizeof(abuf))) {
253                                 Statslog( LDAP_DEBUG_STATS, "conn=%lu op=%lu SRCH attr=%s\n",
254                                     op->o_connid, op->o_opid, abuf, 0, 0 );
255                                 len = 0;
256                                 ptr = abuf;
257                         }
258                         if (len) {
259                                 *ptr++ = ' ';
260                                 len++;
261                         }
262                         ptr = lutil_strncopy(ptr, op->ors_attrs[i].an_name.bv_val, alen);
263                         len += alen;
264                         *ptr = '\0';
265                 }
266                 if (len) {
267                         Statslog( LDAP_DEBUG_STATS, "conn=%lu op=%lu SRCH attr=%s\n",
268                                 op->o_connid, op->o_opid, abuf, 0, 0 );
269                 }
270         }
271
272         manageDSAit = get_manageDSAit( op );
273
274         /* fake while loop to allow breaking out */
275         while ( op->ors_scope == LDAP_SCOPE_BASE ) {
276                 Entry *entry = NULL;
277
278                 if ( BER_BVISEMPTY( &op->o_req_ndn ) ) {
279 #ifdef LDAP_CONNECTIONLESS
280                         /* Ignore LDAPv2 CLDAP Root DSE queries */
281                         if (op->o_protocol == LDAP_VERSION2 && op->o_conn->c_is_udp) {
282                                 goto return_results;
283                         }
284 #endif
285                         /* check restrictions */
286                         if( backend_check_restrictions( op, rs, NULL ) != LDAP_SUCCESS ) {
287                                 send_ldap_result( op, rs );
288                                 goto return_results;
289                         }
290
291 #ifdef LDAP_SLAPI
292                         if ( op->o_pb ) {
293                                 attrs = anlist2charray( op, op->ors_attrs );
294                                 init_search_pblock( op, attrs, manageDSAit );
295                                 rs->sr_err = call_search_preop_plugins( op );
296                                 if ( rs->sr_err ) break;
297                                 call_search_rewrite_plugins( op );
298                         }
299 #endif /* LDAP_SLAPI */
300                         rs->sr_err = root_dse_info( op->o_conn, &entry, &rs->sr_text );
301
302                 } else if ( bvmatch( &op->o_req_ndn, &global_schemandn ) ) {
303                         /* check restrictions */
304                         if( backend_check_restrictions( op, rs, NULL ) != LDAP_SUCCESS ) {
305                                 send_ldap_result( op, rs );
306                                 goto return_results;
307                         }
308
309 #ifdef LDAP_SLAPI
310                         if ( op->o_pb ) {
311                                 attrs = anlist2charray( op, op->ors_attrs );
312                                 init_search_pblock( op, attrs, manageDSAit );
313                                 rs->sr_err = call_search_preop_plugins( op );
314                                 if ( rs->sr_err ) break;
315                                 call_search_rewrite_plugins( op );
316                         }
317 #endif /* LDAP_SLAPI */
318                         rs->sr_err = schema_info( &entry, &rs->sr_text );
319                 }
320
321                 if( rs->sr_err != LDAP_SUCCESS ) {
322                         send_ldap_result( op, rs );
323 #ifdef LDAP_SLAPI
324                         if ( op->o_pb ) call_search_postop_plugins( op );
325 #endif /* LDAP_SLAPI */
326                         goto return_results;
327
328                 } else if ( entry != NULL ) {
329                         rs->sr_err = test_filter( op, entry, op->ors_filter );
330
331                         if( rs->sr_err == LDAP_COMPARE_TRUE ) {
332                                 rs->sr_entry = entry;
333                                 rs->sr_attrs = op->ors_attrs;
334                                 rs->sr_operational_attrs = NULL;
335                                 send_search_entry( op, rs );
336                                 rs->sr_entry = NULL;
337                                 rs->sr_operational_attrs = NULL;
338                         }
339                         entry_free( entry );
340
341                         rs->sr_err = LDAP_SUCCESS;
342                         send_ldap_result( op, rs );
343 #ifdef LDAP_SLAPI
344                         if ( op->o_pb ) call_search_postop_plugins( op );
345 #endif /* LDAP_SLAPI */
346                         goto return_results;
347                 }
348                 break;
349         }
350
351         if( BER_BVISEMPTY( &op->o_req_ndn ) && !BER_BVISEMPTY( &default_search_nbase ) ) {
352                 slap_sl_free( op->o_req_dn.bv_val, op->o_tmpmemctx );
353                 slap_sl_free( op->o_req_ndn.bv_val, op->o_tmpmemctx );
354
355                 ber_dupbv_x( &op->o_req_dn, &default_search_base, op->o_tmpmemctx );
356                 ber_dupbv_x( &op->o_req_ndn, &default_search_nbase, op->o_tmpmemctx );
357         }
358
359         /*
360          * We could be serving multiple database backends.  Select the
361          * appropriate one, or send a referral to our "referral server"
362          * if we don't hold it.
363          */
364
365         /* Sync control overrides manageDSAit */
366
367         if ( manageDSAit != SLAP_NO_CONTROL ) {
368                 if ( op->o_sync_mode & SLAP_SYNC_REFRESH ) {
369                         be_manageDSAit = SLAP_NO_CONTROL;
370                 } else {
371                         be_manageDSAit = manageDSAit;
372                 }
373         } else {
374                 be_manageDSAit = manageDSAit;
375         }
376
377         op->o_bd = select_backend( &op->o_req_ndn, be_manageDSAit, 1 );
378         if ( op->o_bd == NULL ) {
379                 rs->sr_ref = referral_rewrite( default_referral,
380                         NULL, &op->o_req_dn, op->ors_scope );
381
382                 if (!rs->sr_ref) rs->sr_ref = default_referral;
383                 rs->sr_err = LDAP_REFERRAL;
384                 send_ldap_result( op, rs );
385
386                 if (rs->sr_ref != default_referral)
387                 ber_bvarray_free( rs->sr_ref );
388                 rs->sr_ref = NULL;
389                 goto return_results;
390         }
391
392         /* check restrictions */
393         if( backend_check_restrictions( op, rs, NULL ) != LDAP_SUCCESS ) {
394                 send_ldap_result( op, rs );
395                 goto return_results;
396         }
397
398         /* check for referrals */
399         if( backend_check_referrals( op, rs ) != LDAP_SUCCESS ) {
400                 goto return_results;
401         }
402
403 #ifdef LDAP_SLAPI
404         if ( op->o_pb ) {
405                 attrs = anlist2charray( op, op->ors_attrs );
406                 init_search_pblock( op, attrs, manageDSAit );
407                 rs->sr_err = call_search_preop_plugins( op );
408                 if ( rs->sr_err != LDAP_SUCCESS ) {
409                         goto return_results;
410                 }
411
412                 call_search_rewrite_plugins( op );
413         }
414 #endif /* LDAP_SLAPI */
415
416         /* actually do the search and send the result(s) */
417         if ( op->o_bd->be_search ) {
418                 if ( limits_check( op, rs ) == 0 ) {
419                         (op->o_bd->be_search)( op, rs );
420                 }
421                 /* else limits_check() sends error */
422
423         } else {
424                 send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
425                         "operation not supported within namingContext" );
426         }
427
428 #ifdef LDAP_SLAPI
429         if ( op->o_pb ) call_search_postop_plugins( op );
430 #endif /* LDAP_SLAPI */
431
432 return_results:;
433         if ( ( op->o_sync_mode & SLAP_SYNC_PERSIST ) ) return rs->sr_err;
434         if ( ( op->o_sync_slog_size != -1 ) ) return rs->sr_err;
435
436         if( !BER_BVISNULL( &op->o_req_dn ) ) {
437                 slap_sl_free( op->o_req_dn.bv_val, op->o_tmpmemctx );
438         }
439         if( !BER_BVISNULL( &op->o_req_ndn ) ) {
440                 slap_sl_free( op->o_req_ndn.bv_val, op->o_tmpmemctx );
441         }
442
443         if( !BER_BVISNULL( &op->ors_filterstr ) ) {
444                 op->o_tmpfree( op->ors_filterstr.bv_val, op->o_tmpmemctx );
445         }
446         if( op->ors_filter != NULL) filter_free_x( op, op->ors_filter );
447         if( op->ors_attrs != NULL ) {
448                 op->o_tmpfree( op->ors_attrs, op->o_tmpmemctx );
449         }
450
451 #ifdef LDAP_SLAPI
452         if( attrs != NULL) op->o_tmpfree( attrs, op->o_tmpmemctx );
453 #endif /* LDAP_SLAPI */
454
455         return rs->sr_err;
456 }
457
458 #ifdef LDAP_SLAPI
459
460 static char **anlist2charray( Operation *op, AttributeName *an )
461 {
462         char **attrs;
463         int i;
464
465         if ( an != NULL ) {
466                 for ( i = 0; !BER_BVISNULL( &an[i].an_name ); i++ )
467                         ;
468                 attrs = (char **)op->o_tmpalloc( (i + 1) * sizeof(char *), op->o_tmpmemctx );
469                 for ( i = 0; !BER_BVISNULL( &an[i].an_name ); i++ ) {
470                         attrs[i] = an[i].an_name.bv_val;
471                 }
472                 attrs[i] = NULL;
473         } else {
474                 attrs = NULL;
475         }
476
477         return attrs;
478 }
479
480 static void init_search_pblock( Operation *op,
481         char **attrs, int managedsait )
482 {
483         slapi_int_pblock_set_operation( op->o_pb, op );
484         slapi_pblock_set( op->o_pb, SLAPI_SEARCH_TARGET, (void *)op->o_req_dn.bv_val );
485         slapi_pblock_set( op->o_pb, SLAPI_SEARCH_SCOPE, (void *)op->ors_scope );
486         slapi_pblock_set( op->o_pb, SLAPI_SEARCH_DEREF, (void *)op->ors_deref );
487         slapi_pblock_set( op->o_pb, SLAPI_SEARCH_SIZELIMIT, (void *)op->ors_slimit );
488         slapi_pblock_set( op->o_pb, SLAPI_SEARCH_TIMELIMIT, (void *)op->ors_tlimit );
489         slapi_pblock_set( op->o_pb, SLAPI_SEARCH_FILTER, (void *)op->ors_filter );
490         slapi_pblock_set( op->o_pb, SLAPI_SEARCH_STRFILTER, (void *)op->ors_filterstr.bv_val );
491         slapi_pblock_set( op->o_pb, SLAPI_SEARCH_ATTRS, (void *)attrs );
492         slapi_pblock_set( op->o_pb, SLAPI_SEARCH_ATTRSONLY, (void *)op->ors_attrsonly );
493         slapi_pblock_set( op->o_pb, SLAPI_MANAGEDSAIT, (void *)managedsait );
494 }
495
496 static int call_search_preop_plugins( Operation *op )
497 {
498         int rc;
499
500         rc = slapi_int_call_plugins( op->o_bd, SLAPI_PLUGIN_PRE_SEARCH_FN, op->o_pb );
501         if ( rc < 0 ) {
502                 /*
503                  * A preoperation plugin failure will abort the
504                  * entire operation.
505                  */
506 #ifdef NEW_LOGGING
507                 LDAP_LOG( OPERATION, INFO, "call_search_preop_plugins: search preoperation plugin "
508                                 "returned %d\n", rc, 0, 0 );
509 #else
510                 Debug(LDAP_DEBUG_TRACE, "call_search_preop_plugins: search preoperation plugin "
511                                 "returned %d.\n", rc, 0, 0);
512 #endif
513                 if ( ( slapi_pblock_get( op->o_pb, SLAPI_RESULT_CODE, (void *)&rc ) != 0 ) ||
514                      rc == LDAP_SUCCESS ) {
515                         rc = LDAP_OTHER;
516                 }
517         } else {
518                 rc = LDAP_SUCCESS;
519         }
520
521         return rc;
522 }
523
524 static int call_search_rewrite_plugins( Operation *op )
525 {
526         if ( slapi_int_call_plugins( op->o_bd, SLAPI_PLUGIN_COMPUTE_SEARCH_REWRITER_FN, op->o_pb ) == 0 ) {
527                 int rc;
528
529                 /*
530                  * The plugin can set the SLAPI_SEARCH_FILTER.
531                  * SLAPI_SEARCH_STRFILER is not normative.
532                  */
533                 slapi_pblock_get( op->o_pb, SLAPI_SEARCH_FILTER, (void *)&op->ors_filter );
534                 op->o_tmpfree( op->ors_filterstr.bv_val, op->o_tmpmemctx );
535                 filter2bv_x( op, op->ors_filter, &op->ors_filterstr );
536
537                 /*
538                  * Also permit other search parameters to be reset. One thing
539                  * this doesn't (yet) deal with is plugins that change a root
540                  * DSE search to a non-root DSE search...
541                  */
542                 slapi_pblock_get( op->o_pb, SLAPI_SEARCH_TARGET, (void **)&op->o_req_dn.bv_val );
543                 op->o_req_dn.bv_len = strlen( op->o_req_dn.bv_val );
544
545                 if( !BER_BVISNULL( &op->o_req_ndn ) ) {
546                         slap_sl_free( op->o_req_ndn.bv_val, op->o_tmpmemctx );
547                 }
548                 rc = dnNormalize( 0, NULL, NULL, &op->o_req_dn, &op->o_req_ndn,
549                         op->o_tmpmemctx );
550                 if ( rc != LDAP_SUCCESS ) {
551                         return rc;
552                 }
553
554                 slapi_pblock_get( op->o_pb, SLAPI_SEARCH_SCOPE, (void **)&op->ors_scope );
555                 slapi_pblock_get( op->o_pb, SLAPI_SEARCH_DEREF, (void **)&op->ors_deref );
556
557 #ifdef NEW_LOGGING
558                 LDAP_LOG( OPERATION, ARGS, 
559                         "call_search_rewrite_plugins: after compute_rewrite_search filter: %s\n", 
560                         !BER_BVISEMPTY( &op->ors_filterstr ) ? op->ors_filterstr.bv_val : "empty", 0, 0 );
561 #else
562                 Debug( LDAP_DEBUG_ARGS, "    after compute_rewrite_search filter: %s\n",
563                         !BER_BVISEMPTY( &op->ors_filterstr ) ? op->ors_filterstr.bv_val : "empty", 0, 0 );
564 #endif
565         }
566
567         return LDAP_SUCCESS;
568 }
569
570 static void call_search_postop_plugins( Operation *op )
571 {
572         if ( slapi_int_call_plugins( op->o_bd, SLAPI_PLUGIN_POST_SEARCH_FN, op->o_pb ) < 0 ) {
573 #ifdef NEW_LOGGING
574                 LDAP_LOG( OPERATION, INFO, "call_search_postop_plugins: search postoperation plugins "
575                                 "failed\n", 0, 0, 0 );
576 #else
577                 Debug(LDAP_DEBUG_TRACE, "call_search_postop_plugins: search postoperation plugins "
578                                 "failed.\n", 0, 0, 0);
579 #endif
580         }
581 }
582
583 void slapi_int_dummy(void)
584 {
585         /*
586          * XXX slapi_search_internal() was no getting pulled
587          * in; all manner of linker flags failed to link it.
588          * FIXME
589          */
590         slapi_search_internal( NULL, 0, NULL, NULL, NULL, 0 );
591 }
592 #endif /* LDAP_SLAPI */
593