slapd-search.c revision 1.1.1.2 1 1.1.1.2 lukem /* $NetBSD: slapd-search.c,v 1.1.1.2 2010/03/08 02:14:20 lukem Exp $ */
2 1.1.1.2 lukem
3 1.1.1.2 lukem /* OpenLDAP: pkg/ldap/tests/progs/slapd-search.c,v 1.41.2.11 2009/07/01 17:09:44 quanah Exp */
4 1.1 lukem /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 1.1 lukem *
6 1.1.1.2 lukem * Copyright 1999-2009 The OpenLDAP Foundation.
7 1.1 lukem * All rights reserved.
8 1.1 lukem *
9 1.1 lukem * Redistribution and use in source and binary forms, with or without
10 1.1 lukem * modification, are permitted only as authorized by the OpenLDAP
11 1.1 lukem * Public License.
12 1.1 lukem *
13 1.1 lukem * A copy of this license is available in file LICENSE in the
14 1.1 lukem * top-level directory of the distribution or, alternatively, at
15 1.1 lukem * <http://www.OpenLDAP.org/license.html>.
16 1.1 lukem */
17 1.1 lukem /* ACKNOWLEDGEMENTS:
18 1.1 lukem * This work was initially developed by Kurt Spanier for inclusion
19 1.1 lukem * in OpenLDAP Software.
20 1.1 lukem */
21 1.1 lukem
22 1.1 lukem #include "portable.h"
23 1.1 lukem
24 1.1 lukem #include <stdio.h>
25 1.1 lukem
26 1.1 lukem #include "ac/stdlib.h"
27 1.1 lukem
28 1.1 lukem #include "ac/ctype.h"
29 1.1 lukem #include "ac/param.h"
30 1.1 lukem #include "ac/socket.h"
31 1.1 lukem #include "ac/string.h"
32 1.1 lukem #include "ac/unistd.h"
33 1.1 lukem #include "ac/wait.h"
34 1.1 lukem
35 1.1 lukem #include "ldap.h"
36 1.1 lukem #include "lutil.h"
37 1.1 lukem #include "ldap_pvt.h"
38 1.1 lukem
39 1.1 lukem #include "slapd-common.h"
40 1.1 lukem
41 1.1 lukem #define LOOPS 100
42 1.1 lukem #define RETRIES 0
43 1.1 lukem
44 1.1 lukem static void
45 1.1 lukem do_search( char *uri, char *manager, struct berval *passwd,
46 1.1 lukem char *sbase, int scope, char *filter, LDAP **ldp,
47 1.1 lukem char **attrs, int noattrs, int nobind,
48 1.1 lukem int innerloop, int maxretries, int delay, int force, int chaserefs );
49 1.1 lukem
50 1.1 lukem static void
51 1.1 lukem do_random( char *uri, char *manager, struct berval *passwd,
52 1.1 lukem char *sbase, int scope, char *filter, char *attr,
53 1.1 lukem char **attrs, int noattrs, int nobind,
54 1.1 lukem int innerloop, int maxretries, int delay, int force, int chaserefs );
55 1.1 lukem
56 1.1 lukem static void
57 1.1 lukem usage( char *name, char o )
58 1.1 lukem {
59 1.1 lukem if ( o != '\0' ) {
60 1.1 lukem fprintf( stderr, "unknown/incorrect option \"%c\"\n", o );
61 1.1 lukem }
62 1.1 lukem
63 1.1 lukem fprintf( stderr,
64 1.1 lukem "usage: %s "
65 1.1 lukem "-H <uri> | ([-h <host>] -p <port>) "
66 1.1 lukem "-D <manager> "
67 1.1 lukem "-w <passwd> "
68 1.1 lukem "-b <searchbase> "
69 1.1 lukem "-s <scope> "
70 1.1 lukem "-f <searchfilter> "
71 1.1 lukem "[-a <attr>] "
72 1.1 lukem "[-A] "
73 1.1 lukem "[-C] "
74 1.1 lukem "[-F] "
75 1.1 lukem "[-N] "
76 1.1.1.2 lukem "[-S] "
77 1.1 lukem "[-i <ignore>] "
78 1.1 lukem "[-l <loops>] "
79 1.1 lukem "[-L <outerloops>] "
80 1.1 lukem "[-r <maxretries>] "
81 1.1 lukem "[-t <delay>] "
82 1.1 lukem "[<attrs>] "
83 1.1 lukem "\n",
84 1.1 lukem name );
85 1.1 lukem exit( EXIT_FAILURE );
86 1.1 lukem }
87 1.1 lukem
88 1.1.1.2 lukem /* Just send requests without reading responses */
89 1.1.1.2 lukem static int swamp;
90 1.1.1.2 lukem
91 1.1 lukem int
92 1.1 lukem main( int argc, char **argv )
93 1.1 lukem {
94 1.1 lukem int i;
95 1.1 lukem char *uri = NULL;
96 1.1 lukem char *host = "localhost";
97 1.1 lukem int port = -1;
98 1.1 lukem char *manager = NULL;
99 1.1 lukem struct berval passwd = { 0, NULL };
100 1.1 lukem char *sbase = NULL;
101 1.1 lukem int scope = LDAP_SCOPE_SUBTREE;
102 1.1 lukem char *filter = NULL;
103 1.1 lukem char *attr = NULL;
104 1.1 lukem char *srchattrs[] = { "cn", "sn", NULL };
105 1.1 lukem char **attrs = srchattrs;
106 1.1 lukem int loops = LOOPS;
107 1.1 lukem int outerloops = 1;
108 1.1 lukem int retries = RETRIES;
109 1.1 lukem int delay = 0;
110 1.1 lukem int force = 0;
111 1.1 lukem int chaserefs = 0;
112 1.1 lukem int noattrs = 0;
113 1.1 lukem int nobind = 0;
114 1.1 lukem
115 1.1 lukem tester_init( "slapd-search", TESTER_SEARCH );
116 1.1 lukem
117 1.1 lukem /* by default, tolerate referrals and no such object */
118 1.1 lukem tester_ignore_str2errlist( "REFERRAL,NO_SUCH_OBJECT" );
119 1.1 lukem
120 1.1.1.2 lukem while ( ( i = getopt( argc, argv, "Aa:b:CD:f:FH:h:i:l:L:Np:r:Ss:t:T:w:" ) ) != EOF )
121 1.1 lukem {
122 1.1 lukem switch ( i ) {
123 1.1 lukem case 'A':
124 1.1 lukem noattrs++;
125 1.1 lukem break;
126 1.1 lukem
127 1.1 lukem case 'C':
128 1.1 lukem chaserefs++;
129 1.1 lukem break;
130 1.1 lukem
131 1.1 lukem case 'H': /* the server uri */
132 1.1 lukem uri = strdup( optarg );
133 1.1 lukem break;
134 1.1 lukem
135 1.1 lukem case 'h': /* the servers host */
136 1.1 lukem host = strdup( optarg );
137 1.1 lukem break;
138 1.1 lukem
139 1.1 lukem case 'i':
140 1.1 lukem tester_ignore_str2errlist( optarg );
141 1.1 lukem break;
142 1.1 lukem
143 1.1 lukem case 'N':
144 1.1 lukem nobind++;
145 1.1 lukem break;
146 1.1 lukem
147 1.1 lukem case 'p': /* the servers port */
148 1.1 lukem if ( lutil_atoi( &port, optarg ) != 0 ) {
149 1.1 lukem usage( argv[0], i );
150 1.1 lukem }
151 1.1 lukem break;
152 1.1 lukem
153 1.1 lukem case 'D': /* the servers manager */
154 1.1 lukem manager = strdup( optarg );
155 1.1 lukem break;
156 1.1 lukem
157 1.1 lukem case 'w': /* the server managers password */
158 1.1 lukem passwd.bv_val = strdup( optarg );
159 1.1 lukem passwd.bv_len = strlen( optarg );
160 1.1 lukem memset( optarg, '*', passwd.bv_len );
161 1.1 lukem break;
162 1.1 lukem
163 1.1 lukem case 'a':
164 1.1 lukem attr = strdup( optarg );
165 1.1 lukem break;
166 1.1 lukem
167 1.1 lukem case 'b': /* file with search base */
168 1.1 lukem sbase = strdup( optarg );
169 1.1 lukem break;
170 1.1 lukem
171 1.1 lukem case 'f': /* the search request */
172 1.1 lukem filter = strdup( optarg );
173 1.1 lukem break;
174 1.1 lukem
175 1.1 lukem case 'F':
176 1.1 lukem force++;
177 1.1 lukem break;
178 1.1 lukem
179 1.1 lukem case 'l': /* number of loops */
180 1.1 lukem if ( lutil_atoi( &loops, optarg ) != 0 ) {
181 1.1 lukem usage( argv[0], i );
182 1.1 lukem }
183 1.1 lukem break;
184 1.1 lukem
185 1.1 lukem case 'L': /* number of loops */
186 1.1 lukem if ( lutil_atoi( &outerloops, optarg ) != 0 ) {
187 1.1 lukem usage( argv[0], i );
188 1.1 lukem }
189 1.1 lukem break;
190 1.1 lukem
191 1.1 lukem case 'r': /* number of retries */
192 1.1 lukem if ( lutil_atoi( &retries, optarg ) != 0 ) {
193 1.1 lukem usage( argv[0], i );
194 1.1 lukem }
195 1.1 lukem break;
196 1.1 lukem
197 1.1 lukem case 't': /* delay in seconds */
198 1.1 lukem if ( lutil_atoi( &delay, optarg ) != 0 ) {
199 1.1 lukem usage( argv[0], i );
200 1.1 lukem }
201 1.1 lukem break;
202 1.1 lukem
203 1.1 lukem case 'T':
204 1.1 lukem attrs = ldap_str2charray( optarg, "," );
205 1.1 lukem if ( attrs == NULL ) {
206 1.1 lukem usage( argv[0], i );
207 1.1 lukem }
208 1.1 lukem break;
209 1.1 lukem
210 1.1.1.2 lukem case 'S':
211 1.1.1.2 lukem swamp++;
212 1.1.1.2 lukem break;
213 1.1.1.2 lukem
214 1.1 lukem case 's':
215 1.1 lukem scope = ldap_pvt_str2scope( optarg );
216 1.1 lukem if ( scope == -1 ) {
217 1.1 lukem usage( argv[0], i );
218 1.1 lukem }
219 1.1 lukem break;
220 1.1 lukem
221 1.1 lukem default:
222 1.1 lukem usage( argv[0], i );
223 1.1 lukem break;
224 1.1 lukem }
225 1.1 lukem }
226 1.1 lukem
227 1.1 lukem if (( sbase == NULL ) || ( filter == NULL ) || ( port == -1 && uri == NULL ))
228 1.1 lukem usage( argv[0], '\0' );
229 1.1 lukem
230 1.1 lukem if ( *filter == '\0' ) {
231 1.1 lukem
232 1.1 lukem fprintf( stderr, "%s: invalid EMPTY search filter.\n",
233 1.1 lukem argv[0] );
234 1.1 lukem exit( EXIT_FAILURE );
235 1.1 lukem
236 1.1 lukem }
237 1.1 lukem
238 1.1 lukem if ( argv[optind] != NULL ) {
239 1.1 lukem attrs = &argv[optind];
240 1.1 lukem }
241 1.1 lukem
242 1.1 lukem uri = tester_uri( uri, host, port );
243 1.1 lukem
244 1.1 lukem for ( i = 0; i < outerloops; i++ ) {
245 1.1 lukem if ( attr != NULL ) {
246 1.1 lukem do_random( uri, manager, &passwd,
247 1.1 lukem sbase, scope, filter, attr,
248 1.1 lukem attrs, noattrs, nobind,
249 1.1 lukem loops, retries, delay, force, chaserefs );
250 1.1 lukem
251 1.1 lukem } else {
252 1.1 lukem do_search( uri, manager, &passwd,
253 1.1 lukem sbase, scope, filter, NULL,
254 1.1 lukem attrs, noattrs, nobind,
255 1.1 lukem loops, retries, delay, force, chaserefs );
256 1.1 lukem }
257 1.1 lukem }
258 1.1 lukem
259 1.1 lukem exit( EXIT_SUCCESS );
260 1.1 lukem }
261 1.1 lukem
262 1.1 lukem
263 1.1 lukem static void
264 1.1 lukem do_random( char *uri, char *manager, struct berval *passwd,
265 1.1 lukem char *sbase, int scope, char *filter, char *attr,
266 1.1 lukem char **srchattrs, int noattrs, int nobind,
267 1.1 lukem int innerloop, int maxretries, int delay, int force, int chaserefs )
268 1.1 lukem {
269 1.1 lukem LDAP *ld = NULL;
270 1.1 lukem int i = 0, do_retry = maxretries;
271 1.1 lukem char *attrs[ 2 ];
272 1.1 lukem int rc = LDAP_SUCCESS;
273 1.1 lukem int version = LDAP_VERSION3;
274 1.1 lukem int nvalues = 0;
275 1.1 lukem char **values = NULL;
276 1.1 lukem LDAPMessage *res = NULL, *e = NULL;
277 1.1 lukem
278 1.1 lukem attrs[ 0 ] = attr;
279 1.1 lukem attrs[ 1 ] = NULL;
280 1.1 lukem
281 1.1 lukem ldap_initialize( &ld, uri );
282 1.1 lukem if ( ld == NULL ) {
283 1.1 lukem tester_perror( "ldap_initialize", NULL );
284 1.1 lukem exit( EXIT_FAILURE );
285 1.1 lukem }
286 1.1 lukem
287 1.1 lukem (void) ldap_set_option( ld, LDAP_OPT_PROTOCOL_VERSION, &version );
288 1.1 lukem (void) ldap_set_option( ld, LDAP_OPT_REFERRALS,
289 1.1 lukem chaserefs ? LDAP_OPT_ON : LDAP_OPT_OFF );
290 1.1 lukem
291 1.1 lukem if ( do_retry == maxretries ) {
292 1.1 lukem fprintf( stderr, "PID=%ld - Search(%d): base=\"%s\", filter=\"%s\" attr=\"%s\".\n",
293 1.1 lukem (long) pid, innerloop, sbase, filter, attr );
294 1.1 lukem }
295 1.1 lukem
296 1.1 lukem if ( nobind == 0 ) {
297 1.1 lukem rc = ldap_sasl_bind_s( ld, manager, LDAP_SASL_SIMPLE, passwd, NULL, NULL, NULL );
298 1.1 lukem if ( rc != LDAP_SUCCESS ) {
299 1.1 lukem tester_ldap_error( ld, "ldap_sasl_bind_s", NULL );
300 1.1 lukem switch ( rc ) {
301 1.1 lukem case LDAP_BUSY:
302 1.1 lukem case LDAP_UNAVAILABLE:
303 1.1 lukem /* fallthru */
304 1.1 lukem default:
305 1.1 lukem break;
306 1.1 lukem }
307 1.1 lukem exit( EXIT_FAILURE );
308 1.1 lukem }
309 1.1 lukem }
310 1.1 lukem
311 1.1 lukem rc = ldap_search_ext_s( ld, sbase, LDAP_SCOPE_SUBTREE,
312 1.1 lukem filter, attrs, 0, NULL, NULL, NULL, LDAP_NO_LIMIT, &res );
313 1.1 lukem switch ( rc ) {
314 1.1 lukem case LDAP_SIZELIMIT_EXCEEDED:
315 1.1 lukem case LDAP_TIMELIMIT_EXCEEDED:
316 1.1 lukem case LDAP_SUCCESS:
317 1.1 lukem if ( ldap_count_entries( ld, res ) == 0 ) {
318 1.1 lukem if ( rc ) {
319 1.1 lukem tester_ldap_error( ld, "ldap_search_ext_s", NULL );
320 1.1 lukem }
321 1.1 lukem break;
322 1.1 lukem }
323 1.1 lukem
324 1.1 lukem for ( e = ldap_first_entry( ld, res ); e != NULL; e = ldap_next_entry( ld, e ) )
325 1.1 lukem {
326 1.1 lukem struct berval **v = ldap_get_values_len( ld, e, attr );
327 1.1 lukem
328 1.1 lukem if ( v != NULL ) {
329 1.1 lukem int n = ldap_count_values_len( v );
330 1.1 lukem int j;
331 1.1 lukem
332 1.1 lukem values = realloc( values, ( nvalues + n + 1 )*sizeof( char * ) );
333 1.1 lukem for ( j = 0; j < n; j++ ) {
334 1.1 lukem values[ nvalues + j ] = strdup( v[ j ]->bv_val );
335 1.1 lukem }
336 1.1 lukem values[ nvalues + j ] = NULL;
337 1.1 lukem nvalues += n;
338 1.1 lukem ldap_value_free_len( v );
339 1.1 lukem }
340 1.1 lukem }
341 1.1 lukem
342 1.1 lukem ldap_msgfree( res );
343 1.1 lukem
344 1.1 lukem if ( !values ) {
345 1.1 lukem fprintf( stderr, " PID=%ld - Search base=\"%s\" filter=\"%s\" got %d values.\n",
346 1.1 lukem (long) pid, sbase, filter, nvalues );
347 1.1 lukem exit(EXIT_FAILURE);
348 1.1 lukem }
349 1.1 lukem
350 1.1 lukem if ( do_retry == maxretries ) {
351 1.1 lukem fprintf( stderr, " PID=%ld - Search base=\"%s\" filter=\"%s\" got %d values.\n",
352 1.1 lukem (long) pid, sbase, filter, nvalues );
353 1.1 lukem }
354 1.1 lukem
355 1.1 lukem for ( i = 0; i < innerloop; i++ ) {
356 1.1 lukem char buf[ BUFSIZ ];
357 1.1 lukem #if 0 /* use high-order bits for better randomness (Numerical Recipes in "C") */
358 1.1 lukem int r = rand() % nvalues;
359 1.1 lukem #endif
360 1.1 lukem int r = ((double)nvalues)*rand()/(RAND_MAX + 1.0);
361 1.1 lukem
362 1.1 lukem snprintf( buf, sizeof( buf ), "(%s=%s)", attr, values[ r ] );
363 1.1 lukem
364 1.1 lukem do_search( uri, manager, passwd,
365 1.1 lukem sbase, scope, buf, &ld,
366 1.1 lukem srchattrs, noattrs, nobind,
367 1.1 lukem 1, maxretries, delay, force, chaserefs );
368 1.1 lukem }
369 1.1 lukem break;
370 1.1 lukem
371 1.1 lukem default:
372 1.1 lukem tester_ldap_error( ld, "ldap_search_ext_s", NULL );
373 1.1 lukem break;
374 1.1 lukem }
375 1.1 lukem
376 1.1.1.2 lukem fprintf( stderr, " PID=%ld - Search done (%d).\n", (long) pid, rc );
377 1.1 lukem
378 1.1 lukem if ( ld != NULL ) {
379 1.1 lukem ldap_unbind_ext( ld, NULL, NULL );
380 1.1 lukem }
381 1.1 lukem }
382 1.1 lukem
383 1.1 lukem static void
384 1.1 lukem do_search( char *uri, char *manager, struct berval *passwd,
385 1.1 lukem char *sbase, int scope, char *filter, LDAP **ldp,
386 1.1 lukem char **attrs, int noattrs, int nobind,
387 1.1 lukem int innerloop, int maxretries, int delay, int force, int chaserefs )
388 1.1 lukem {
389 1.1 lukem LDAP *ld = ldp ? *ldp : NULL;
390 1.1 lukem int i = 0, do_retry = maxretries;
391 1.1 lukem int rc = LDAP_SUCCESS;
392 1.1 lukem int version = LDAP_VERSION3;
393 1.1 lukem char buf[ BUFSIZ ];
394 1.1 lukem
395 1.1 lukem
396 1.1 lukem retry:;
397 1.1 lukem if ( ld == NULL ) {
398 1.1 lukem ldap_initialize( &ld, uri );
399 1.1 lukem if ( ld == NULL ) {
400 1.1 lukem tester_perror( "ldap_initialize", NULL );
401 1.1 lukem exit( EXIT_FAILURE );
402 1.1 lukem }
403 1.1 lukem
404 1.1 lukem (void) ldap_set_option( ld, LDAP_OPT_PROTOCOL_VERSION, &version );
405 1.1 lukem (void) ldap_set_option( ld, LDAP_OPT_REFERRALS,
406 1.1 lukem chaserefs ? LDAP_OPT_ON : LDAP_OPT_OFF );
407 1.1 lukem
408 1.1 lukem if ( do_retry == maxretries ) {
409 1.1 lukem fprintf( stderr,
410 1.1 lukem "PID=%ld - Search(%d): "
411 1.1 lukem "base=\"%s\" scope=%s filter=\"%s\" "
412 1.1 lukem "attrs=%s%s.\n",
413 1.1 lukem (long) pid, innerloop,
414 1.1 lukem sbase, ldap_pvt_scope2str( scope ), filter,
415 1.1 lukem attrs[0], attrs[1] ? " (more...)" : "" );
416 1.1 lukem }
417 1.1 lukem
418 1.1 lukem if ( nobind == 0 ) {
419 1.1 lukem rc = ldap_sasl_bind_s( ld, manager, LDAP_SASL_SIMPLE, passwd, NULL, NULL, NULL );
420 1.1 lukem if ( rc != LDAP_SUCCESS ) {
421 1.1 lukem snprintf( buf, sizeof( buf ),
422 1.1 lukem "bindDN=\"%s\"", manager );
423 1.1 lukem tester_ldap_error( ld, "ldap_sasl_bind_s", buf );
424 1.1 lukem switch ( rc ) {
425 1.1 lukem case LDAP_BUSY:
426 1.1 lukem case LDAP_UNAVAILABLE:
427 1.1 lukem if ( do_retry > 0 ) {
428 1.1 lukem ldap_unbind_ext( ld, NULL, NULL );
429 1.1 lukem ld = NULL;
430 1.1 lukem do_retry--;
431 1.1 lukem if ( delay != 0 ) {
432 1.1 lukem sleep( delay );
433 1.1 lukem }
434 1.1 lukem goto retry;
435 1.1 lukem }
436 1.1 lukem /* fallthru */
437 1.1 lukem default:
438 1.1 lukem break;
439 1.1 lukem }
440 1.1 lukem exit( EXIT_FAILURE );
441 1.1 lukem }
442 1.1 lukem }
443 1.1 lukem }
444 1.1 lukem
445 1.1 lukem for ( ; i < innerloop; i++ ) {
446 1.1 lukem LDAPMessage *res = NULL;
447 1.1 lukem
448 1.1.1.2 lukem if (swamp) {
449 1.1.1.2 lukem int msgid;
450 1.1.1.2 lukem rc = ldap_search_ext( ld, sbase, scope,
451 1.1.1.2 lukem filter, NULL, noattrs, NULL, NULL,
452 1.1.1.2 lukem NULL, LDAP_NO_LIMIT, &msgid );
453 1.1.1.2 lukem if ( rc == LDAP_SUCCESS ) continue;
454 1.1.1.2 lukem else break;
455 1.1.1.2 lukem }
456 1.1.1.2 lukem
457 1.1 lukem rc = ldap_search_ext_s( ld, sbase, scope,
458 1.1 lukem filter, attrs, noattrs, NULL, NULL,
459 1.1 lukem NULL, LDAP_NO_LIMIT, &res );
460 1.1 lukem if ( res != NULL ) {
461 1.1 lukem ldap_msgfree( res );
462 1.1 lukem }
463 1.1 lukem
464 1.1 lukem if ( rc ) {
465 1.1.1.2 lukem int first = tester_ignore_err( rc );
466 1.1 lukem /* if ignore.. */
467 1.1 lukem if ( first ) {
468 1.1 lukem /* only log if first occurrence */
469 1.1.1.2 lukem if ( ( force < 2 && first > 0 ) || abs(first) == 1 ) {
470 1.1 lukem tester_ldap_error( ld, "ldap_search_ext_s", NULL );
471 1.1 lukem }
472 1.1 lukem continue;
473 1.1 lukem }
474 1.1 lukem
475 1.1 lukem /* busy needs special handling */
476 1.1 lukem snprintf( buf, sizeof( buf ),
477 1.1 lukem "base=\"%s\" filter=\"%s\"\n",
478 1.1 lukem sbase, filter );
479 1.1 lukem tester_ldap_error( ld, "ldap_search_ext_s", buf );
480 1.1 lukem if ( rc == LDAP_BUSY && do_retry > 0 ) {
481 1.1 lukem ldap_unbind_ext( ld, NULL, NULL );
482 1.1 lukem ld = NULL;
483 1.1 lukem do_retry--;
484 1.1 lukem goto retry;
485 1.1 lukem }
486 1.1 lukem break;
487 1.1 lukem }
488 1.1 lukem }
489 1.1 lukem
490 1.1 lukem if ( ldp != NULL ) {
491 1.1 lukem *ldp = ld;
492 1.1 lukem
493 1.1 lukem } else {
494 1.1.1.2 lukem fprintf( stderr, " PID=%ld - Search done (%d).\n", (long) pid, rc );
495 1.1 lukem
496 1.1 lukem if ( ld != NULL ) {
497 1.1 lukem ldap_unbind_ext( ld, NULL, NULL );
498 1.1 lukem }
499 1.1 lukem }
500 1.1 lukem }
501