chaserefs ? LDAP_OPT_ON : LDAP_OPT_OFF );
if ( do_retry == maxretries ) {
- fprintf( stderr, "PID=%ld - Search(%d): base=\"%s\", filter=\"%s\".\n",
- (long) pid, innerloop, sbase, filter );
+ 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 ) {
passwd = pw.bv_val;
}
+ if ( !sfile && !rfile && !nfile && !mfile && !bfile && !anum ) {
+ fprintf( stderr, "no data files found.\n" );
+ exit( EXIT_FAILURE );
+ }
+
/* look for search requests */
if ( sfile ) {
snum = get_search_filters( sfile, sreqs, sattrs, sbase, slud );
- if ( snum == -1 ) {
- fprintf( stderr, "unable to parse file \"%s\"\n", sfile );
+ if ( snum < 0 ) {
+ fprintf( stderr,
+ "unable to parse file \"%s\" line %d\n",
+ sfile, -2*(snum + 1));
exit( EXIT_FAILURE );
}
}
/* look for read requests */
if ( rfile ) {
rnum = get_read_entries( rfile, rreqs, rflts );
- if ( rnum == -1 ) {
- fprintf( stderr, "unable to parse file \"%s\"\n", rfile );
+ if ( rnum < 0 ) {
+ fprintf( stderr,
+ "unable to parse file \"%s\" line %d\n",
+ rfile, -2*(rnum + 1) );
exit( EXIT_FAILURE );
}
}
/* look for modrdn requests */
if ( nfile ) {
nnum = get_read_entries( nfile, nreqs, NULL );
- if ( nnum == -1 ) {
- fprintf( stderr, "unable to parse file \"%s\"\n", nfile );
+ if ( nnum < 0 ) {
+ fprintf( stderr,
+ "unable to parse file \"%s\" line %d\n",
+ nfile, -2*(nnum + 1) );
exit( EXIT_FAILURE );
}
}
/* look for modify requests */
if ( mfile ) {
mnum = get_search_filters( mfile, mreqs, NULL, mdn, NULL );
- if ( mnum == -1 ) {
- fprintf( stderr, "unable to parse file \"%s\"\n", mfile );
+ if ( mnum < 0 ) {
+ fprintf( stderr,
+ "unable to parse file \"%s\" line %d\n",
+ mfile, -2*(mnum + 1) );
exit( EXIT_FAILURE );
}
}
/* look for bind requests */
if ( bfile ) {
bnum = get_search_filters( bfile, bcreds, battrs, breqs, NULL );
- if ( bnum == -1 ) {
- fprintf( stderr, "unable to parse file \"%s\"\n", bfile );
+ if ( bnum < 0 ) {
+ fprintf( stderr,
+ "unable to parse file \"%s\" line %d\n",
+ bfile, -2*(bnum + 1) );
exit( EXIT_FAILURE );
}
}
got_URL = 1;
bases[filter] = NULL;
if ( ldap_url_parse( line, &lud ) != LDAP_URL_SUCCESS ) {
- filter = -1;
+ filter = -filter - 1;
break;
}
if ( lud->lud_dn == NULL || lud->lud_exts != NULL ) {
- filter = -1;
+ filter = -filter - 1;
break;
}
LDAPURLDesc *lud;
if ( ldap_url_parse( &line[1], &lud ) != LDAP_URL_SUCCESS ) {
- entry = -1;
+ entry = -entry - 1;
break;
}
if ( lud->lud_dn == NULL || lud->lud_dn[ 0 ] == '\0' ) {
ldap_free_urldesc( lud );
- entry = -1;
+ entry = -entry - 1;
break;
}