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