]> git.sur5r.net Git - openldap/blob - servers/slapd/search.c
limit checking in syncrepl
[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                 } else {
168                         send_ldap_result( op, rs );
169                 }
170                 goto return_results;
171         }
172         filter2bv_x( op, op->ors_filter, &op->ors_filterstr );
173
174 #ifdef NEW_LOGGING
175         LDAP_LOG( OPERATION, ARGS, 
176                 "do_search: conn %d     filter: %s\n", 
177                 op->o_connid, !BER_BVISEMPTY( &op->ors_filterstr ) ? op->ors_filterstr.bv_val : "empty",
178                 0 );
179 #else
180         Debug( LDAP_DEBUG_ARGS, "    filter: %s\n",
181                 !BER_BVISEMPTY( &op->ors_filterstr ) ? op->ors_filterstr.bv_val : "empty", 0, 0 );
182 #endif
183
184         /* attributes */
185         siz = sizeof(AttributeName);
186         off = offsetof(AttributeName,an_name);
187         if ( ber_scanf( op->o_ber, "{M}}", &op->ors_attrs, &siz, off ) == LBER_ERROR ) {
188                 send_ldap_discon( op, rs, LDAP_PROTOCOL_ERROR, "decoding attrs error" );
189                 rs->sr_err = SLAPD_DISCONNECT;
190                 goto return_results;
191         }
192         for ( i=0; i<siz; i++ ) {
193                 const char *dummy;      /* ignore msgs from bv2ad */
194                 op->ors_attrs[i].an_desc = NULL;
195                 op->ors_attrs[i].an_oc = NULL;
196                 op->ors_attrs[i].an_oc_exclude = 0;
197                 slap_bv2ad(&op->ors_attrs[i].an_name, &op->ors_attrs[i].an_desc, &dummy);
198         }
199
200         if( get_ctrls( op, rs, 1 ) != LDAP_SUCCESS ) {
201 #ifdef NEW_LOGGING
202                 LDAP_LOG( OPERATION, INFO, 
203                         "do_search: conn %d  get_ctrls failed (%d)\n",
204                         op->o_connid, rs->sr_err, 0 );
205 #else
206                 Debug( LDAP_DEBUG_ANY, "do_search: get_ctrls failed\n", 0, 0, 0 );
207 #endif
208
209                 goto return_results;
210         }
211
212 #ifdef NEW_LOGGING
213         LDAP_LOG( OPERATION, ARGS, 
214                 "do_search: conn %d     attrs:", op->o_connid, 0, 0 );
215 #else
216         Debug( LDAP_DEBUG_ARGS, "    attrs:", 0, 0, 0 );
217 #endif
218
219         if ( siz != 0 ) {
220                 for ( i = 0; i<siz; i++ ) {
221 #ifdef NEW_LOGGING
222                         LDAP_LOG( OPERATION, ARGS, 
223                                 "do_search: %s", op->ors_attrs[i].an_name.bv_val, 0, 0 );
224 #else
225                         Debug( LDAP_DEBUG_ARGS, " %s", op->ors_attrs[i].an_name.bv_val, 0, 0 );
226 #endif
227                 }
228         }
229
230 #ifdef NEW_LOGGING
231         LDAP_LOG( OPERATION, ARGS, "\n" , 0, 0, 0 );
232 #else
233         Debug( LDAP_DEBUG_ARGS, "\n", 0, 0, 0 );
234 #endif
235
236         if ( StatslogTest( LDAP_DEBUG_STATS ) ) {
237                 char abuf[BUFSIZ/2], *ptr = abuf;
238                 int len = 0, alen;
239
240                 sprintf(abuf, "scope=%d deref=%d", op->ors_scope, op->ors_deref);
241                 Statslog( LDAP_DEBUG_STATS,
242                         "conn=%lu op=%lu SRCH base=\"%s\" %s filter=\"%s\"\n",
243                         op->o_connid, op->o_opid, op->o_req_dn.bv_val, abuf,
244                         op->ors_filterstr.bv_val );
245
246                 for ( i = 0; i<siz; i++ ) {
247                         alen = op->ors_attrs[i].an_name.bv_len;
248                         if (alen >= sizeof(abuf)) {
249                                 alen = sizeof(abuf)-1;
250                         }
251                         if (len && (len + 1 + alen >= sizeof(abuf))) {
252                                 Statslog( LDAP_DEBUG_STATS, "conn=%lu op=%lu SRCH attr=%s\n",
253                                     op->o_connid, op->o_opid, abuf, 0, 0 );
254                                 len = 0;
255                                 ptr = abuf;
256                         }
257                         if (len) {
258                                 *ptr++ = ' ';
259                                 len++;
260                         }
261                         ptr = lutil_strncopy(ptr, op->ors_attrs[i].an_name.bv_val, alen);
262                         len += alen;
263                         *ptr = '\0';
264                 }
265                 if (len) {
266                         Statslog( LDAP_DEBUG_STATS, "conn=%lu op=%lu SRCH attr=%s\n",
267                                 op->o_connid, op->o_opid, abuf, 0, 0 );
268                 }
269         }
270
271         manageDSAit = get_manageDSAit( op );
272
273         /* fake while loop to allow breaking out */
274         while ( op->ors_scope == LDAP_SCOPE_BASE ) {
275                 Entry *entry = NULL;
276
277                 if ( BER_BVISEMPTY( &op->o_req_ndn ) ) {
278 #ifdef LDAP_CONNECTIONLESS
279                         /* Ignore LDAPv2 CLDAP Root DSE queries */
280                         if (op->o_protocol == LDAP_VERSION2 && op->o_conn->c_is_udp) {
281                                 goto return_results;
282                         }
283 #endif
284                         /* check restrictions */
285                         if( backend_check_restrictions( op, rs, NULL ) != LDAP_SUCCESS ) {
286                                 send_ldap_result( op, rs );
287                                 goto return_results;
288                         }
289
290 #ifdef LDAP_SLAPI
291                         if ( op->o_pb ) {
292                                 attrs = anlist2charray( op, op->ors_attrs );
293                                 init_search_pblock( op, attrs, manageDSAit );
294                                 rs->sr_err = call_search_preop_plugins( op );
295                                 if ( rs->sr_err ) break;
296                                 call_search_rewrite_plugins( op );
297                         }
298 #endif /* LDAP_SLAPI */
299                         rs->sr_err = root_dse_info( op->o_conn, &entry, &rs->sr_text );
300
301                 } else if ( bvmatch( &op->o_req_ndn, &global_schemandn ) ) {
302                         /* check restrictions */
303                         if( backend_check_restrictions( op, rs, NULL ) != LDAP_SUCCESS ) {
304                                 send_ldap_result( op, rs );
305                                 goto return_results;
306                         }
307
308 #ifdef LDAP_SLAPI
309                         if ( op->o_pb ) {
310                                 attrs = anlist2charray( op, op->ors_attrs );
311                                 init_search_pblock( op, attrs, manageDSAit );
312                                 rs->sr_err = call_search_preop_plugins( op );
313                                 if ( rs->sr_err ) break;
314                                 call_search_rewrite_plugins( op );
315                         }
316 #endif /* LDAP_SLAPI */
317                         rs->sr_err = schema_info( &entry, &rs->sr_text );
318                 }
319
320                 if( rs->sr_err != LDAP_SUCCESS ) {
321                         send_ldap_result( op, rs );
322 #ifdef LDAP_SLAPI
323                         if ( op->o_pb ) call_search_postop_plugins( op );
324 #endif /* LDAP_SLAPI */
325                         goto return_results;
326
327                 } else if ( entry != NULL ) {
328                         rs->sr_err = test_filter( op, entry, op->ors_filter );
329
330                         if( rs->sr_err == LDAP_COMPARE_TRUE ) {
331                                 rs->sr_entry = entry;
332                                 rs->sr_attrs = op->ors_attrs;
333                                 send_search_entry( op, rs );
334                                 rs->sr_entry = NULL;
335                         }
336                         entry_free( entry );
337
338                         rs->sr_err = LDAP_SUCCESS;
339                         send_ldap_result( op, rs );
340 #ifdef LDAP_SLAPI
341                         if ( op->o_pb ) call_search_postop_plugins( op );
342 #endif /* LDAP_SLAPI */
343                         goto return_results;
344                 }
345                 break;
346         }
347
348         if( BER_BVISEMPTY( &op->o_req_ndn ) && !BER_BVISEMPTY( &default_search_nbase ) ) {
349                 slap_sl_free( op->o_req_dn.bv_val, op->o_tmpmemctx );
350                 slap_sl_free( op->o_req_ndn.bv_val, op->o_tmpmemctx );
351
352                 ber_dupbv_x( &op->o_req_dn, &default_search_base, op->o_tmpmemctx );
353                 ber_dupbv_x( &op->o_req_ndn, &default_search_nbase, op->o_tmpmemctx );
354         }
355
356         /*
357          * We could be serving multiple database backends.  Select the
358          * appropriate one, or send a referral to our "referral server"
359          * if we don't hold it.
360          */
361
362         /* Sync control overrides manageDSAit */
363
364         if ( manageDSAit != SLAP_NO_CONTROL ) {
365                 if ( op->o_sync_mode & SLAP_SYNC_REFRESH ) {
366                         be_manageDSAit = SLAP_NO_CONTROL;
367                 } else {
368                         be_manageDSAit = manageDSAit;
369                 }
370         } else {
371                 be_manageDSAit = manageDSAit;
372         }
373
374         op->o_bd = select_backend( &op->o_req_ndn, be_manageDSAit, 1 );
375         if ( op->o_bd == NULL ) {
376                 rs->sr_ref = referral_rewrite( default_referral,
377                         NULL, &op->o_req_dn, op->ors_scope );
378
379                 if (!rs->sr_ref) rs->sr_ref = default_referral;
380                 rs->sr_err = LDAP_REFERRAL;
381                 send_ldap_result( op, rs );
382
383                 if (rs->sr_ref != default_referral)
384                 ber_bvarray_free( rs->sr_ref );
385                 rs->sr_ref = NULL;
386                 goto return_results;
387         }
388
389         /* check restrictions */
390         if( backend_check_restrictions( op, rs, NULL ) != LDAP_SUCCESS ) {
391                 send_ldap_result( op, rs );
392                 goto return_results;
393         }
394
395         /* check for referrals */
396         if( backend_check_referrals( op, rs ) != LDAP_SUCCESS ) {
397                 goto return_results;
398         }
399
400 #ifdef LDAP_SLAPI
401         if ( op->o_pb ) {
402                 attrs = anlist2charray( op, op->ors_attrs );
403                 init_search_pblock( op, attrs, manageDSAit );
404                 rs->sr_err = call_search_preop_plugins( op );
405                 if ( rs->sr_err != LDAP_SUCCESS ) {
406                         goto return_results;
407                 }
408
409                 call_search_rewrite_plugins( op );
410         }
411 #endif /* LDAP_SLAPI */
412
413         /* actually do the search and send the result(s) */
414         if ( op->o_bd->be_search ) {
415                 if ( limits_check( op, rs ) == 0 ) {
416                         (op->o_bd->be_search)( op, rs );
417                 }
418                 /* else limits_check() sends error */
419
420         } else {
421                 send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
422                         "operation not supported within namingContext" );
423         }
424
425 #ifdef LDAP_SLAPI
426         if ( op->o_pb ) call_search_postop_plugins( op );
427 #endif /* LDAP_SLAPI */
428
429 return_results:;
430
431         if ( ( op->o_sync_mode & SLAP_SYNC_PERSIST ) )
432                 return rs->sr_err;
433
434         if ( ( op->o_sync_slog_size != -1 ) )
435                 return rs->sr_err;
436
437         if( !BER_BVISNULL( &op->o_req_dn ) ) slap_sl_free( op->o_req_dn.bv_val, op->o_tmpmemctx );
438         if( !BER_BVISNULL( &op->o_req_ndn ) ) slap_sl_free( op->o_req_ndn.bv_val, op->o_tmpmemctx );
439
440         if( !BER_BVISNULL( &op->ors_filterstr ) ) op->o_tmpfree( op->ors_filterstr.bv_val, op->o_tmpmemctx );
441         if( op->ors_filter != NULL) filter_free_x( op, op->ors_filter );
442         if( op->ors_attrs != NULL ) op->o_tmpfree( op->ors_attrs, op->o_tmpmemctx );
443 #ifdef LDAP_SLAPI
444         if( attrs != NULL) op->o_tmpfree( attrs, op->o_tmpmemctx );
445 #endif /* LDAP_SLAPI */
446
447         return rs->sr_err;
448 }
449
450 #ifdef LDAP_SLAPI
451
452 static char **anlist2charray( Operation *op, AttributeName *an )
453 {
454         char **attrs;
455         int i;
456
457         if ( an != NULL ) {
458                 for ( i = 0; !BER_BVISNULL( &an[i].an_name ); i++ )
459                         ;
460                 attrs = (char **)op->o_tmpalloc( (i + 1) * sizeof(char *), op->o_tmpmemctx );
461                 for ( i = 0; !BER_BVISNULL( &an[i].an_name ); i++ ) {
462                         attrs[i] = an[i].an_name.bv_val;
463                 }
464                 attrs[i] = NULL;
465         } else {
466                 attrs = NULL;
467         }
468
469         return attrs;
470 }
471
472 static void init_search_pblock( Operation *op,
473         char **attrs, int managedsait )
474 {
475         slapi_int_pblock_set_operation( op->o_pb, op );
476         slapi_pblock_set( op->o_pb, SLAPI_SEARCH_TARGET, (void *)op->o_req_dn.bv_val );
477         slapi_pblock_set( op->o_pb, SLAPI_SEARCH_SCOPE, (void *)op->ors_scope );
478         slapi_pblock_set( op->o_pb, SLAPI_SEARCH_DEREF, (void *)op->ors_deref );
479         slapi_pblock_set( op->o_pb, SLAPI_SEARCH_SIZELIMIT, (void *)op->ors_slimit );
480         slapi_pblock_set( op->o_pb, SLAPI_SEARCH_TIMELIMIT, (void *)op->ors_tlimit );
481         slapi_pblock_set( op->o_pb, SLAPI_SEARCH_FILTER, (void *)op->ors_filter );
482         slapi_pblock_set( op->o_pb, SLAPI_SEARCH_STRFILTER, (void *)op->ors_filterstr.bv_val );
483         slapi_pblock_set( op->o_pb, SLAPI_SEARCH_ATTRS, (void *)attrs );
484         slapi_pblock_set( op->o_pb, SLAPI_SEARCH_ATTRSONLY, (void *)op->ors_attrsonly );
485         slapi_pblock_set( op->o_pb, SLAPI_MANAGEDSAIT, (void *)managedsait );
486 }
487
488 static int call_search_preop_plugins( Operation *op )
489 {
490         int rc;
491
492         rc = slapi_int_call_plugins( op->o_bd, SLAPI_PLUGIN_PRE_SEARCH_FN, op->o_pb );
493         if ( rc < 0 ) {
494                 /*
495                  * A preoperation plugin failure will abort the
496                  * entire operation.
497                  */
498 #ifdef NEW_LOGGING
499                 LDAP_LOG( OPERATION, INFO, "call_search_preop_plugins: search preoperation plugin "
500                                 "returned %d\n", rc, 0, 0 );
501 #else
502                 Debug(LDAP_DEBUG_TRACE, "call_search_preop_plugins: search preoperation plugin "
503                                 "returned %d.\n", rc, 0, 0);
504 #endif
505                 if ( ( slapi_pblock_get( op->o_pb, SLAPI_RESULT_CODE, (void *)&rc ) != 0 ) ||
506                      rc == LDAP_SUCCESS ) {
507                         rc = LDAP_OTHER;
508                 }
509         } else {
510                 rc = LDAP_SUCCESS;
511         }
512
513         return rc;
514 }
515
516 static int call_search_rewrite_plugins( Operation *op )
517 {
518         if ( slapi_int_call_plugins( op->o_bd, SLAPI_PLUGIN_COMPUTE_SEARCH_REWRITER_FN, op->o_pb ) == 0 ) {
519                 int rc;
520
521                 /*
522                  * The plugin can set the SLAPI_SEARCH_FILTER.
523                  * SLAPI_SEARCH_STRFILER is not normative.
524                  */
525                 slapi_pblock_get( op->o_pb, SLAPI_SEARCH_FILTER, (void *)&op->ors_filter );
526                 op->o_tmpfree( op->ors_filterstr.bv_val, op->o_tmpmemctx );
527                 filter2bv_x( op, op->ors_filter, &op->ors_filterstr );
528
529                 /*
530                  * Also permit other search parameters to be reset. One thing
531                  * this doesn't (yet) deal with is plugins that change a root
532                  * DSE search to a non-root DSE search...
533                  */
534                 slapi_pblock_get( op->o_pb, SLAPI_SEARCH_TARGET, (void **)&op->o_req_dn.bv_val );
535                 op->o_req_dn.bv_len = strlen( op->o_req_dn.bv_val );
536
537                 if( !BER_BVISNULL( &op->o_req_ndn ) ) {
538                         slap_sl_free( op->o_req_ndn.bv_val, op->o_tmpmemctx );
539                 }
540                 rc = dnNormalize( 0, NULL, NULL, &op->o_req_dn, &op->o_req_ndn,
541                         op->o_tmpmemctx );
542                 if ( rc != LDAP_SUCCESS ) {
543                         return rc;
544                 }
545
546                 slapi_pblock_get( op->o_pb, SLAPI_SEARCH_SCOPE, (void **)&op->ors_scope );
547                 slapi_pblock_get( op->o_pb, SLAPI_SEARCH_DEREF, (void **)&op->ors_deref );
548
549 #ifdef NEW_LOGGING
550                 LDAP_LOG( OPERATION, ARGS, 
551                         "call_search_rewrite_plugins: after compute_rewrite_search filter: %s\n", 
552                         !BER_BVISEMPTY( &op->ors_filterstr ) ? op->ors_filterstr.bv_val : "empty", 0, 0 );
553 #else
554                 Debug( LDAP_DEBUG_ARGS, "    after compute_rewrite_search filter: %s\n",
555                         !BER_BVISEMPTY( &op->ors_filterstr ) ? op->ors_filterstr.bv_val : "empty", 0, 0 );
556 #endif
557         }
558
559         return LDAP_SUCCESS;
560 }
561
562 static void call_search_postop_plugins( Operation *op )
563 {
564         if ( slapi_int_call_plugins( op->o_bd, SLAPI_PLUGIN_POST_SEARCH_FN, op->o_pb ) < 0 ) {
565 #ifdef NEW_LOGGING
566                 LDAP_LOG( OPERATION, INFO, "call_search_postop_plugins: search postoperation plugins "
567                                 "failed\n", 0, 0, 0 );
568 #else
569                 Debug(LDAP_DEBUG_TRACE, "call_search_postop_plugins: search postoperation plugins "
570                                 "failed.\n", 0, 0, 0);
571 #endif
572         }
573 }
574
575 void slapi_int_dummy(void)
576 {
577         /*
578          * XXX slapi_search_internal() was no getting pulled
579          * in; all manner of linker flags failed to link it.
580          * FIXME
581          */
582         slapi_search_internal( NULL, 0, NULL, NULL, NULL, 0 );
583 }
584 #endif /* LDAP_SLAPI */
585