From: Pierangelo Masarati Date: Sat, 21 Jan 2006 16:27:15 +0000 (+0000) Subject: -FF means: log just once X-Git-Tag: OPENLDAP_REL_ENG_2_4_BP~277 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=cf94f444fc3875e90243120b08bb0a7f79f74b02;p=openldap -FF means: log just once --- diff --git a/tests/progs/slapd-bind.c b/tests/progs/slapd-bind.c index 63409c0be0..e6a6fdb96b 100644 --- a/tests/progs/slapd-bind.c +++ b/tests/progs/slapd-bind.c @@ -117,7 +117,7 @@ main( int argc, char **argv ) break; case 'F': - force = 1; + force++; break; default: @@ -145,7 +145,7 @@ static int do_bind( char *uri, char *dn, struct berval *pass, int maxloop, int force ) { LDAP *ld = NULL; - int i, rc = -1; + int i, first = 1, rc = -1; pid_t pid = getpid(); if ( maxloop > 1 ) @@ -167,7 +167,21 @@ do_bind( char *uri, char *dn, struct berval *pass, int maxloop, int force ) } rc = ldap_sasl_bind_s( ld, dn, LDAP_SASL_SIMPLE, pass, NULL, NULL, NULL ); - if ( rc != LDAP_SUCCESS ) { + switch ( rc ) { + case LDAP_SUCCESS: + break; + + case LDAP_INVALID_CREDENTIALS: + /* don't log: it's intended */ + if ( force >= 2 ) { + if ( !first ) { + break; + } + first = 0; + } + /* fallthru */ + + default: tester_ldap_error( ld, "ldap_sasl_bind_s" ); } ldap_unbind_ext( ld, NULL, NULL ); diff --git a/tests/progs/slapd-tester.c b/tests/progs/slapd-tester.c index 565b55ccc2..19c18bf0b3 100644 --- a/tests/progs/slapd-tester.c +++ b/tests/progs/slapd-tester.c @@ -154,6 +154,8 @@ main( int argc, char **argv ) int banum; char bcmd[MAXPATHLEN]; + char *friendlyOpt = NULL; + tester_init( "slapd-tester" ); while ( (i = getopt( argc, argv, "D:d:FH:h:j:l:P:p:r:t:w:" )) != EOF ) { @@ -282,6 +284,23 @@ main( int argc, char **argv ) bnum = get_search_filters( bfile, bcreds, breqs ); } + /* setup friendly option */ + + switch ( friendly ) { + case 0: + break; + + case 1: + friendlyOpt = "-F"; + break; + + default: + /* NOTE: right now we don't need it more than twice */ + case 2: + friendlyOpt = "-FF"; + break; + } + /* * generate the search clients */ @@ -370,7 +389,7 @@ main( int argc, char **argv ) margs[manum++] = "-t"; margs[manum++] = delay; if ( friendly ) { - margs[manum++] = "-F"; + margs[manum++] = friendlyOpt; } margs[manum++] = "-e"; margs[manum++] = NULL; /* will hold the modrdn entry */ @@ -404,7 +423,7 @@ main( int argc, char **argv ) modargs[modanum++] = "-t"; modargs[modanum++] = delay; if ( friendly ) { - modargs[modanum++] = "-F"; + modargs[modanum++] = friendlyOpt; } modargs[modanum++] = "-e"; modargs[modanum++] = NULL; /* will hold the modify entry */ @@ -440,7 +459,7 @@ main( int argc, char **argv ) aargs[aanum++] = "-t"; aargs[aanum++] = delay; if ( friendly ) { - aargs[aanum++] = "-F"; + aargs[aanum++] = friendlyOpt; } aargs[aanum++] = "-f"; aargs[aanum++] = NULL; /* will hold the add data file */ @@ -472,7 +491,7 @@ main( int argc, char **argv ) bargs[banum++] = delay; #endif if ( friendly ) { - bargs[banum++] = "-F"; + bargs[banum++] = friendlyOpt; } bargs[banum++] = "-D"; bargs[banum++] = NULL;