static void
do_addel( char *uri, char *host, int port, char *manager, char *passwd,
- char *dn, LDAPMod **attrs, int maxloop, int maxretries );
+ char *dn, LDAPMod **attrs, int maxloop, int maxretries, int delay );
static void
usage( char *name )
{
- fprintf( stderr, "usage: %s [-h <host>] -p port -D <managerDN> -w <passwd> -f <addfile> [-l <loops>]\n",
+ fprintf( stderr,
+ "usage: %s "
+ "-H <uri> | ([-h <host>] -p <port>) "
+ "-D <manager> "
+ "-w <passwd> "
+ "-f <addfile> "
+ "[-l <loops>] "
+ "[-r <maxretries>] "
+ "[-t <delay>]\n",
name );
exit( EXIT_FAILURE );
}
char *entry = NULL;
int loops = LOOPS;
int retries = RETRIES;
+ int delay = 0;
LDAPMod **attrs = NULL;
- while ( (i = getopt( argc, argv, "H:h:p:D:w:f:l:r:" )) != EOF ) {
+ while ( (i = getopt( argc, argv, "H:h:p:D:w:f:l:r:t:" )) != EOF ) {
switch( i ) {
case 'H': /* the server's URI */
uri = strdup( optarg );
loops = atoi( optarg );
break;
- case 'r':
+ case 'r': /* number of retries */
retries = atoi( optarg );
break;
+ case 't': /* delay in seconds */
+ delay = atoi( optarg );
+ break;
+
default:
usage( argv[0] );
break;
}
do_addel( uri, host, port, manager, passwd, entry, attrs,
- loops, retries );
+ loops, retries, delay );
exit( EXIT_SUCCESS );
}
char *entry,
LDAPMod **attrs,
int maxloop,
- int maxretries
+ int maxretries,
+ int delay
)
{
LDAP *ld = NULL;
switch ( rc ) {
case LDAP_BUSY:
case LDAP_UNAVAILABLE:
- if ( do_retry == 1 ) {
- do_retry = 0;
- sleep( 1 );
+ if ( do_retry > 0 ) {
+ do_retry--;
+ if ( delay != 0 ) {
+ sleep( delay );
+ }
goto retry;
}
/* fallthru */
static void
do_modify( char *uri, char *host, int port, char *manager, char *passwd,
char *entry, char *attr, char *value, int maxloop,
- int maxretries );
+ int maxretries, int delay );
static void
usage( char *name )
{
- fprintf( stderr, "usage: %s [-h <host>] -p port -D <managerDN> -w <passwd> -e <entry> [-l <loops>]\n",
+ fprintf( stderr,
+ "usage: %s "
+ "-H <uri> | ([-h <host>] -p <port>) "
+ "-D <manager> "
+ "-w <passwd> "
+ "-e <entry> "
+ "[-l <loops>] "
+ "[-r <maxretries>] "
+ "[-t <delay>]\n",
name );
exit( EXIT_FAILURE );
}
char *value = NULL;
int loops = LOOPS;
int retries = RETRIES;
+ int delay = 0;
- while ( (i = getopt( argc, argv, "H:h:p:D:w:e:a:l:r:" )) != EOF ) {
+ while ( (i = getopt( argc, argv, "H:h:p:D:w:e:a:l:r:t:" )) != EOF ) {
switch( i ) {
case 'H': /* the server uri */
uri = strdup( optarg );
loops = atoi( optarg );
break;
- case 'r':
+ case 'r': /* number of retries */
retries = atoi( optarg );
break;
+ case 't': /* delay in seconds */
+ delay = atoi( optarg );
+ break;
+
default:
usage( argv[0] );
break;
value++;
do_modify( uri, host, port, manager, passwd, entry, ava, value,
- loops, retries );
+ loops, retries, delay );
exit( EXIT_SUCCESS );
}
static void
do_modify( char *uri, char *host, int port, char *manager,
char *passwd, char *entry, char* attr, char* value,
- int maxloop, int maxretries )
+ int maxloop, int maxretries, int delay )
{
LDAP *ld = NULL;
int i = 0, do_retry = maxretries;
switch ( rc ) {
case LDAP_BUSY:
case LDAP_UNAVAILABLE:
- if ( do_retry == 1 ) {
- do_retry = 0;
- sleep( 1 );
+ if ( do_retry > 0 ) {
+ do_retry--;
+ if ( delay > 0 ) {
+ sleep( delay );
+ }
goto retry;
}
/* fallthru */
static void
do_modrdn( char *uri, char *host, int port, char *manager, char *passwd,
- char *entry, int maxloop, int maxretries );
+ char *entry, int maxloop, int maxretries, int delay );
static void
usage( char *name )
{
- fprintf( stderr, "usage: %s [-h <host>] -p port -D <managerDN> -w <passwd> -e <entry> [-l <loops>]\n",
+ fprintf( stderr,
+ "usage: %s "
+ "-H <uri> | ([-h <host>] -p <port>) "
+ "-D <manager> "
+ "-w <passwd> "
+ "-e <entry> "
+ "[-l <loops>] "
+ "[-r <maxretries>] "
+ "[-t <delay>]\n",
name );
exit( EXIT_FAILURE );
}
char *entry = NULL;
int loops = LOOPS;
int retries = RETRIES;
+ int delay = 0;
- while ( (i = getopt( argc, argv, "H:h:p:D:w:e:l:r:" )) != EOF ) {
+ while ( (i = getopt( argc, argv, "H:h:p:D:w:e:l:r:t:" )) != EOF ) {
switch( i ) {
case 'H': /* the server uri */
uri = strdup( optarg );
retries = atoi( optarg );
break;
+ case 't': /* delay in seconds */
+ delay = atoi( optarg );
+ break;
+
default:
usage( argv[0] );
break;
}
- do_modrdn( uri, host, port, manager, passwd, entry, loops, retries );
+ do_modrdn( uri, host, port, manager, passwd, entry, loops, retries, delay );
exit( EXIT_SUCCESS );
}
static void
do_modrdn( char *uri, char *host, int port, char *manager,
- char *passwd, char *entry, int maxloop, int maxretries )
+ char *passwd, char *entry, int maxloop, int maxretries, int delay )
{
LDAP *ld = NULL;
int i = 0, do_retry = maxretries;
switch ( rc ) {
case LDAP_BUSY:
case LDAP_UNAVAILABLE:
- if ( do_retry == 1 ) {
- do_retry = 0;
- sleep( 1 );
+ if ( do_retry > 0 ) {
+ do_retry--;
+ if ( delay > 0) {
+ sleep( delay );
+ }
goto retry;
}
/* fallthru */
static void
do_read( char *uri, char *host, int port, char *entry, int maxloop,
- int maxretries );
+ int maxretries, int delay );
static void
usage( char *name )
{
- fprintf( stderr, "usage: %s [-h <host>] -p port -e <entry> [-l <loops>]\n",
+ fprintf( stderr,
+ "usage: %s "
+ "-H <uri> | ([-h <host>] -p <port>) "
+ "-e <entry> "
+ "[-l <loops>] "
+ "[-r <maxretries>] "
+ "[-t <delay>]\n",
name );
exit( EXIT_FAILURE );
}
char *entry = NULL;
int loops = LOOPS;
int retries = RETRIES;
+ int delay = 0;
- while ( (i = getopt( argc, argv, "H:h:p:e:l:r:" )) != EOF ) {
+ while ( (i = getopt( argc, argv, "H:h:p:e:l:r:t:" )) != EOF ) {
switch( i ) {
case 'H': /* the server uri */
uri = strdup( optarg );
retries = atoi( optarg );
break;
+ case 't': /* delay in seconds */
+ delay = atoi( optarg );
+ break;
+
default:
usage( argv[0] );
break;
exit( EXIT_FAILURE );
}
- do_read( uri, host, port, entry, ( 20 * loops ), retries );
+ do_read( uri, host, port, entry, ( 20 * loops ), retries, delay );
exit( EXIT_SUCCESS );
}
static void
do_read( char *uri, char *host, int port, char *entry, int maxloop,
- int maxretries )
+ int maxretries, int delay )
{
LDAP *ld = NULL;
int i = 0, do_retry = maxretries;
switch ( rc ) {
case LDAP_BUSY:
case LDAP_UNAVAILABLE:
- if ( do_retry == 1 ) {
- do_retry = 0;
- sleep( 1 );
+ if ( do_retry > 0 ) {
+ do_retry--;
+ if ( delay > 0 ) {
+ sleep( delay );
+ }
goto retry;
}
/* fallthru */
static void
do_search( char *uri, char *host, int port, char *manager, char *passwd,
- char *sbase, char *filter, int maxloop, int maxretries );
+ char *sbase, char *filter, int maxloop, int maxretries, int delay );
static void
usage( char *name )
{
- fprintf( stderr, "usage: %s [-h <host>] -p port -b <searchbase> -f <searchfiter> [-l <loops>]\n",
+ fprintf( stderr,
+ "usage: %s "
+ "-H <uri> | ([-h <host>] -p <port>) "
+ "-D <manager> "
+ "-w <passwd> "
+ "-b <searchbase> "
+ "-f <searchfilter> "
+ "[-l <loops>] "
+ "[-r <maxretries>] "
+ "[-t <delay>]\n",
name );
exit( EXIT_FAILURE );
}
char *filter = NULL;
int loops = LOOPS;
int retries = RETRIES;
+ int delay = 0;
- while ( (i = getopt( argc, argv, "b:D:f:H:h:l:p:w:r:" )) != EOF ) {
+ while ( (i = getopt( argc, argv, "b:D:f:H:h:l:p:w:r:t:" )) != EOF ) {
switch( i ) {
case 'H': /* the server uri */
uri = strdup( optarg );
retries = atoi( optarg );
break;
+ case 't': /* delay in seconds */
+ delay = atoi( optarg );
+ break;
+
default:
usage( argv[0] );
break;
}
do_search( uri, host, port, manager, passwd, sbase, filter,
- ( 10 * loops ), retries );
+ ( 10 * loops ), retries, delay );
exit( EXIT_SUCCESS );
}
static void
do_search( char *uri, char *host, int port, char *manager, char *passwd,
- char *sbase, char *filter, int maxloop, int maxretries )
+ char *sbase, char *filter, int maxloop, int maxretries, int delay )
{
LDAP *ld = NULL;
int i = 0, do_retry = maxretries;
case LDAP_UNAVAILABLE:
if ( do_retry > 0 ) {
do_retry--;
- sleep( 1 );
+ if ( delay != 0 ) {
+ sleep( delay );
+ }
goto retry;
}
/* fallthru */
ldap_unbind( ld );
}
-
-
"[-j <maxchild>] "
"[-l <loops>] "
"-P <progdir> "
- "[-r <maxretries>]\n",
+ "[-r <maxretries>]"
+ "[-t <delay>]\n",
name );
exit( EXIT_FAILURE );
}
char *progdir = NULL;
char *loops = LOOPS;
char *retries = RETRIES;
+ char *delay = "0";
DIR *datadir;
struct dirent *file;
char *sfile = NULL;
char *moddn[MAXREQS];
int modnum = 0;
- while ( (i = getopt( argc, argv, "D:d:H:h:j:l:P:p:r:w:" )) != EOF ) {
+ while ( (i = getopt( argc, argv, "D:d:H:h:j:l:P:p:r:t:w:" )) != EOF ) {
switch( i ) {
case 'D': /* slapd manager */
manager = ArgDup( optarg );
port = strdup( optarg );
break;
- case 'r':
+ case 'r': /* the number of retries in case of error */
retries = strdup( optarg );
break;
+ case 't': /* the delay in seconds between each retry */
+ delay = strdup( optarg );
+ break;
+
case 'w': /* the managers passwd */
passwd = ArgDup( optarg );
break;
sargs[sanum++] = loops;
sargs[sanum++] = "-r";
sargs[sanum++] = retries;
+ sargs[sanum++] = "-t";
+ sargs[sanum++] = delay;
sargs[sanum++] = "-b";
sargs[sanum++] = NULL; /* will hold the search base */
sargs[sanum++] = "-f";
rargs[ranum++] = loops;
rargs[ranum++] = "-r";
rargs[ranum++] = retries;
+ rargs[ranum++] = "-t";
+ rargs[ranum++] = delay;
rargs[ranum++] = "-e";
rargs[ranum++] = NULL; /* will hold the read entry */
rargs[ranum++] = NULL;
margs[manum++] = loops;
margs[manum++] = "-r";
margs[manum++] = retries;
+ margs[manum++] = "-t";
+ margs[manum++] = delay;
margs[manum++] = "-e";
margs[manum++] = NULL; /* will hold the modrdn entry */
margs[manum++] = NULL;
modargs[modanum++] = loops;
modargs[modanum++] = "-r";
modargs[modanum++] = retries;
+ modargs[modanum++] = "-t";
+ modargs[modanum++] = delay;
modargs[modanum++] = "-e";
modargs[modanum++] = NULL; /* will hold the modify entry */
modargs[modanum++] = "-a";;
aargs[aanum++] = loops;
aargs[aanum++] = "-r";
aargs[aanum++] = retries;
+ aargs[aanum++] = "-t";
+ aargs[aanum++] = delay;
aargs[aanum++] = "-f";
aargs[aanum++] = NULL; /* will hold the add data file */
aargs[aanum++] = NULL;