- ldap_initialize( &ld, uri );
- if ( ld == NULL ) {
- tester_perror( "ldap_initialize", NULL );
- exit( EXIT_FAILURE );
- }
-
- (void) ldap_set_option( ld, LDAP_OPT_PROTOCOL_VERSION, &version );
- (void) ldap_set_option( ld, LDAP_OPT_REFERRALS,
- chaserefs ? LDAP_OPT_ON : LDAP_OPT_OFF );
-
- if ( do_retry == maxretries ) {
- fprintf( stderr,
- "PID=%ld - Search(%d): "
- "base=\"%s\" scope=%s filter=\"%s\" "
- "attrs=%s%s.\n",
- (long) pid, innerloop,
- sbase, ldap_pvt_scope2str( scope ), filter,
- attrs[0], attrs[1] ? " (more...)" : "" );
- }
-
- if ( nobind == 0 ) {
- rc = ldap_sasl_bind_s( ld, manager, LDAP_SASL_SIMPLE, passwd, NULL, NULL, NULL );
- if ( rc != LDAP_SUCCESS ) {
- snprintf( buf, sizeof( buf ),
- "bindDN=\"%s\"", manager );
- tester_ldap_error( ld, "ldap_sasl_bind_s", buf );
- switch ( rc ) {
- case LDAP_BUSY:
- case LDAP_UNAVAILABLE:
- if ( do_retry > 0 ) {
- ldap_unbind_ext( ld, NULL, NULL );
- ld = NULL;
- do_retry--;
- if ( delay != 0 ) {
- sleep( delay );
- }
- goto retry;
- }
- /* fallthru */
- default:
- break;
- }
- exit( EXIT_FAILURE );
- }
- }
+ fprintf( stderr,
+ "PID=%ld - Search(%d): "
+ "base=\"%s\" scope=%s filter=\"%s\" "
+ "attrs=%s%s.\n",
+ (long) pid, innerloop,
+ sbase, ldap_pvt_scope2str( scope ), filter,
+ attrs[0], attrs[1] ? " (more...)" : "" );
+
+ tester_init_ld( &ld, config, nobind );