/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 1999-2006 The OpenLDAP Foundation.
+ * Copyright 1999-2009 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
#include <stdio.h>
-#include <ac/stdlib.h>
-#include <ac/time.h>
+#include "ac/stdlib.h"
+#include "ac/time.h"
-#include <ac/ctype.h>
-#include <ac/param.h>
-#include <ac/socket.h>
-#include <ac/string.h>
-#include <ac/unistd.h>
-#include <ac/wait.h>
-#include <ac/time.h>
+#include "ac/ctype.h"
+#include "ac/param.h"
+#include "ac/socket.h"
+#include "ac/string.h"
+#include "ac/unistd.h"
+#include "ac/wait.h"
+#include "ac/time.h"
-#include <ldap.h>
-#include <lutil.h>
-#include <lber_pvt.h>
-#include <ldap_pvt.h>
+#include "ldap.h"
+#include "lutil.h"
+#include "lber_pvt.h"
+#include "ldap_pvt.h"
#include "slapd-common.h"
/* by default, tolerate invalid credentials */
tester_ignore_str2errlist( "INVALID_CREDENTIALS" );
- while ( (i = getopt( argc, argv, "a:b:B:H:h:i:p:D:w:l:L:f:FIt:" )) != EOF ) {
- switch( i ) {
+ while ( ( i = getopt( argc, argv, "a:B:b:D:Ff:H:h:Ii:L:l:p:t:w:" ) ) != EOF )
+ {
+ switch ( i ) {
case 'a':
pwattr = optarg;
break;
uri = tester_uri( uri, host, port );
for ( i = 0; i < outerloops; i++ ) {
+ int rc;
+
if ( base != NULL ) {
- do_base( uri, dn, &pass, base, filter, pwattr, loops,
+ rc = do_base( uri, dn, &pass, base, filter, pwattr, loops,
force, chaserefs, noinit, delay, -1, NULL );
} else {
- do_bind( uri, dn, &pass, loops,
+ rc = do_bind( uri, dn, &pass, loops,
force, chaserefs, noinit, NULL, -1, NULL );
}
+ if ( rc == LDAP_SERVER_DOWN )
+ break;
}
exit( EXIT_SUCCESS );
rc = ldap_sasl_bind_s( ld, dn, LDAP_SASL_SIMPLE, pass, NULL, NULL, NULL );
if ( rc ) {
- unsigned first = tester_ignore_err( rc );
+ int first = tester_ignore_err( rc );
/* if ignore.. */
if ( first ) {
/* only log if first occurrence */
- if ( force < 2 || first == 1 ) {
+ if ( ( force < 2 && first > 0 ) || abs(first) == 1 ) {
tester_ldap_error( ld, "ldap_sasl_bind_s", NULL );
}
rc = LDAP_SUCCESS;
}
if ( maxloop > 1 ) {
- fprintf( stderr, " PID=%ld - Bind done (%d).\n", (long) pid, rc );
+ fprintf( stderr, " PID=%ld - Bind done (%d).\n", (long) pid, rc );
}
if ( ldp && noinit ) {
end = GetTickCount();
end -= beg;
- fprintf( stderr, " PID=%ld - Bind done %d in %d.%03d seconds.\n",
+ fprintf( stderr, " PID=%ld - Bind done %d in %d.%03d seconds.\n",
(long) pid, i, end / 1000, end % 1000 );
#else
gettimeofday( &end, NULL );
}
end.tv_sec -= beg.tv_sec;
- fprintf( stderr, " PID=%ld - Bind done %d in %ld.%06ld seconds.\n",
+ fprintf( stderr, " PID=%ld - Bind done %d in %ld.%06ld seconds.\n",
(long) pid, i, (long) end.tv_sec, (long) end.tv_usec );
#endif