]> git.sur5r.net Git - openldap/blob - servers/slapd/search.c
ITS#3226: Clear attribute flags after schema_check failed
[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                                 send_search_entry( op, rs );
335                                 rs->sr_entry = NULL;
336                         }
337                         entry_free( entry );
338
339                         rs->sr_err = LDAP_SUCCESS;
340                         send_ldap_result( op, rs );
341 #ifdef LDAP_SLAPI
342                         if ( op->o_pb ) call_search_postop_plugins( op );
343 #endif /* LDAP_SLAPI */
344                         goto return_results;
345                 }
346                 break;
347         }
348
349         if( BER_BVISEMPTY( &op->o_req_ndn ) && !BER_BVISEMPTY( &default_search_nbase ) ) {
350                 slap_sl_free( op->o_req_dn.bv_val, op->o_tmpmemctx );
351                 slap_sl_free( op->o_req_ndn.bv_val, op->o_tmpmemctx );
352
353                 ber_dupbv_x( &op->o_req_dn, &default_search_base, op->o_tmpmemctx );
354                 ber_dupbv_x( &op->o_req_ndn, &default_search_nbase, op->o_tmpmemctx );
355         }
356
357         /*
358          * We could be serving multiple database backends.  Select the
359          * appropriate one, or send a referral to our "referral server"
360          * if we don't hold it.
361          */
362
363         /* Sync control overrides manageDSAit */
364
365         if ( manageDSAit != SLAP_NO_CONTROL ) {
366                 if ( op->o_sync_mode & SLAP_SYNC_REFRESH ) {
367                         be_manageDSAit = SLAP_NO_CONTROL;
368                 } else {
369                         be_manageDSAit = manageDSAit;
370                 }
371         } else {
372                 be_manageDSAit = manageDSAit;
373         }
374
375         op->o_bd = select_backend( &op->o_req_ndn, be_manageDSAit, 1 );
376         if ( op->o_bd == NULL ) {
377                 rs->sr_ref = referral_rewrite( default_referral,
378                         NULL, &op->o_req_dn, op->ors_scope );
379
380                 if (!rs->sr_ref) rs->sr_ref = default_referral;
381                 rs->sr_err = LDAP_REFERRAL;
382                 send_ldap_result( op, rs );
383
384                 if (rs->sr_ref != default_referral)
385                 ber_bvarray_free( rs->sr_ref );
386                 rs->sr_ref = NULL;
387                 goto return_results;
388         }
389
390         /* check restrictions */
391         if( backend_check_restrictions( op, rs, NULL ) != LDAP_SUCCESS ) {
392                 send_ldap_result( op, rs );
393                 goto return_results;
394         }
395
396         /* check for referrals */
397         if( backend_check_referrals( op, rs ) != LDAP_SUCCESS ) {
398                 goto return_results;
399         }
400
401 #ifdef LDAP_SLAPI
402         if ( op->o_pb ) {
403                 attrs = anlist2charray( op, op->ors_attrs );
404                 init_search_pblock( op, attrs, manageDSAit );
405                 rs->sr_err = call_search_preop_plugins( op );
406                 if ( rs->sr_err != LDAP_SUCCESS ) {
407                         goto return_results;
408                 }
409
410                 call_search_rewrite_plugins( op );
411         }
412 #endif /* LDAP_SLAPI */
413
414         /* actually do the search and send the result(s) */
415         if ( op->o_bd->be_search ) {
416                 if ( limits_check( op, rs ) == 0 ) {
417                         (op->o_bd->be_search)( op, rs );
418                 }
419                 /* else limits_check() sends error */
420
421         } else {
422                 send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
423                         "operation not supported within namingContext" );
424         }
425
426 #ifdef LDAP_SLAPI
427         if ( op->o_pb ) call_search_postop_plugins( op );
428 #endif /* LDAP_SLAPI */
429
430 return_results:;
431         if ( ( op->o_sync_mode & SLAP_SYNC_PERSIST ) ) return rs->sr_err;
432         if ( ( op->o_sync_slog_size != -1 ) ) return rs->sr_err;
433
434         if( !BER_BVISNULL( &op->o_req_dn ) ) {
435                 slap_sl_free( op->o_req_dn.bv_val, op->o_tmpmemctx );
436         }
437         if( !BER_BVISNULL( &op->o_req_ndn ) ) {
438                 slap_sl_free( op->o_req_ndn.bv_val, op->o_tmpmemctx );
439         }
440
441         if( !BER_BVISNULL( &op->ors_filterstr ) ) {
442                 op->o_tmpfree( op->ors_filterstr.bv_val, op->o_tmpmemctx );
443         }
444         if( op->ors_filter != NULL) filter_free_x( op, op->ors_filter );
445         if( op->ors_attrs != NULL ) {
446                 op->o_tmpfree( op->ors_attrs, op->o_tmpmemctx );
447         }
448
449 #ifdef LDAP_SLAPI
450         if( attrs != NULL) op->o_tmpfree( attrs, op->o_tmpmemctx );
451 #endif /* LDAP_SLAPI */
452
453         return rs->sr_err;
454 }
455
456 #ifdef LDAP_SLAPI
457
458 static char **anlist2charray( Operation *op, AttributeName *an )
459 {
460         char **attrs;
461         int i;
462
463         if ( an != NULL ) {
464                 for ( i = 0; !BER_BVISNULL( &an[i].an_name ); i++ )
465                         ;
466                 attrs = (char **)op->o_tmpalloc( (i + 1) * sizeof(char *), op->o_tmpmemctx );
467                 for ( i = 0; !BER_BVISNULL( &an[i].an_name ); i++ ) {
468                         attrs[i] = an[i].an_name.bv_val;
469                 }
470                 attrs[i] = NULL;
471         } else {
472                 attrs = NULL;
473         }
474
475         return attrs;
476 }
477
478 static void init_search_pblock( Operation *op,
479         char **attrs, int managedsait )
480 {
481         slapi_int_pblock_set_operation( op->o_pb, op );
482         slapi_pblock_set( op->o_pb, SLAPI_SEARCH_TARGET, (void *)op->o_req_dn.bv_val );
483         slapi_pblock_set( op->o_pb, SLAPI_SEARCH_SCOPE, (void *)op->ors_scope );
484         slapi_pblock_set( op->o_pb, SLAPI_SEARCH_DEREF, (void *)op->ors_deref );
485         slapi_pblock_set( op->o_pb, SLAPI_SEARCH_SIZELIMIT, (void *)op->ors_slimit );
486         slapi_pblock_set( op->o_pb, SLAPI_SEARCH_TIMELIMIT, (void *)op->ors_tlimit );
487         slapi_pblock_set( op->o_pb, SLAPI_SEARCH_FILTER, (void *)op->ors_filter );
488         slapi_pblock_set( op->o_pb, SLAPI_SEARCH_STRFILTER, (void *)op->ors_filterstr.bv_val );
489         slapi_pblock_set( op->o_pb, SLAPI_SEARCH_ATTRS, (void *)attrs );
490         slapi_pblock_set( op->o_pb, SLAPI_SEARCH_ATTRSONLY, (void *)op->ors_attrsonly );
491         slapi_pblock_set( op->o_pb, SLAPI_MANAGEDSAIT, (void *)managedsait );
492 }
493
494 static int call_search_preop_plugins( Operation *op )
495 {
496         int rc;
497
498         rc = slapi_int_call_plugins( op->o_bd, SLAPI_PLUGIN_PRE_SEARCH_FN, op->o_pb );
499         if ( rc < 0 ) {
500                 /*
501                  * A preoperation plugin failure will abort the
502                  * entire operation.
503                  */
504 #ifdef NEW_LOGGING
505                 LDAP_LOG( OPERATION, INFO, "call_search_preop_plugins: search preoperation plugin "
506                                 "returned %d\n", rc, 0, 0 );
507 #else
508                 Debug(LDAP_DEBUG_TRACE, "call_search_preop_plugins: search preoperation plugin "
509                                 "returned %d.\n", rc, 0, 0);
510 #endif
511                 if ( ( slapi_pblock_get( op->o_pb, SLAPI_RESULT_CODE, (void *)&rc ) != 0 ) ||
512                      rc == LDAP_SUCCESS ) {
513                         rc = LDAP_OTHER;
514                 }
515         } else {
516                 rc = LDAP_SUCCESS;
517         }
518
519         return rc;
520 }
521
522 static int call_search_rewrite_plugins( Operation *op )
523 {
524         if ( slapi_int_call_plugins( op->o_bd, SLAPI_PLUGIN_COMPUTE_SEARCH_REWRITER_FN, op->o_pb ) == 0 ) {
525                 int rc;
526
527                 /*
528                  * The plugin can set the SLAPI_SEARCH_FILTER.
529                  * SLAPI_SEARCH_STRFILER is not normative.
530                  */
531                 slapi_pblock_get( op->o_pb, SLAPI_SEARCH_FILTER, (void *)&op->ors_filter );
532                 op->o_tmpfree( op->ors_filterstr.bv_val, op->o_tmpmemctx );
533                 filter2bv_x( op, op->ors_filter, &op->ors_filterstr );
534
535                 /*
536                  * Also permit other search parameters to be reset. One thing
537                  * this doesn't (yet) deal with is plugins that change a root
538                  * DSE search to a non-root DSE search...
539                  */
540                 slapi_pblock_get( op->o_pb, SLAPI_SEARCH_TARGET, (void **)&op->o_req_dn.bv_val );
541                 op->o_req_dn.bv_len = strlen( op->o_req_dn.bv_val );
542
543                 if( !BER_BVISNULL( &op->o_req_ndn ) ) {
544                         slap_sl_free( op->o_req_ndn.bv_val, op->o_tmpmemctx );
545                 }
546                 rc = dnNormalize( 0, NULL, NULL, &op->o_req_dn, &op->o_req_ndn,
547                         op->o_tmpmemctx );
548                 if ( rc != LDAP_SUCCESS ) {
549                         return rc;
550                 }
551
552                 slapi_pblock_get( op->o_pb, SLAPI_SEARCH_SCOPE, (void **)&op->ors_scope );
553                 slapi_pblock_get( op->o_pb, SLAPI_SEARCH_DEREF, (void **)&op->ors_deref );
554
555 #ifdef NEW_LOGGING
556                 LDAP_LOG( OPERATION, ARGS, 
557                         "call_search_rewrite_plugins: after compute_rewrite_search filter: %s\n", 
558                         !BER_BVISEMPTY( &op->ors_filterstr ) ? op->ors_filterstr.bv_val : "empty", 0, 0 );
559 #else
560                 Debug( LDAP_DEBUG_ARGS, "    after compute_rewrite_search filter: %s\n",
561                         !BER_BVISEMPTY( &op->ors_filterstr ) ? op->ors_filterstr.bv_val : "empty", 0, 0 );
562 #endif
563         }
564
565         return LDAP_SUCCESS;
566 }
567
568 static void call_search_postop_plugins( Operation *op )
569 {
570         if ( slapi_int_call_plugins( op->o_bd, SLAPI_PLUGIN_POST_SEARCH_FN, op->o_pb ) < 0 ) {
571 #ifdef NEW_LOGGING
572                 LDAP_LOG( OPERATION, INFO, "call_search_postop_plugins: search postoperation plugins "
573                                 "failed\n", 0, 0, 0 );
574 #else
575                 Debug(LDAP_DEBUG_TRACE, "call_search_postop_plugins: search postoperation plugins "
576                                 "failed.\n", 0, 0, 0);
577 #endif
578         }
579 }
580
581 void slapi_int_dummy(void)
582 {
583         /*
584          * XXX slapi_search_internal() was no getting pulled
585          * in; all manner of linker flags failed to link it.
586          * FIXME
587          */
588         slapi_search_internal( NULL, 0, NULL, NULL, NULL, 0 );
589 }
590 #endif /* LDAP_SLAPI */
591