mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-06 10:46:21 +08:00
Change slapd-tester to read search base from file instead of using
the commandline
This commit is contained in:
parent
c6cd37c5cf
commit
feb03bfde5
@ -1,5 +1,10 @@
|
||||
o=university of michigan,c=us
|
||||
cn=Barbara Jensen
|
||||
ou=people,o=university of michigan,c=us
|
||||
cn=Bjorn Jensen
|
||||
ou=people,o=university of michigan,c=us
|
||||
cn=James A Jones 1
|
||||
o=university of michigan,c=us
|
||||
cn=Bjorn Jensen
|
||||
o=university of michigan,c=us
|
||||
cn=Alumni Assoc Staff
|
||||
|
@ -35,7 +35,7 @@
|
||||
#define TMODRDNFILE "do_modrdn.0"
|
||||
|
||||
static char *get_file_name( char *dirname, char *filename );
|
||||
static int get_search_filters( char *filename, char *filters[] );
|
||||
static int get_search_filters( char *filename, char *filters[], char *bases[] );
|
||||
static int get_read_entries( char *filename, char *entries[] );
|
||||
static void fork_child( char *prog, char **args );
|
||||
static void wait4kids( int nkidval );
|
||||
@ -54,7 +54,7 @@ static char argbuf[BUFSIZ];
|
||||
static void
|
||||
usage( char *name )
|
||||
{
|
||||
fprintf( stderr, "usage: %s [-h <host>] -p <port> -D <manager> -w <passwd> -d <datadir> -b <baseDN> [-j <maxchild>] [-l <loops>] -P <progdir>\n", name );
|
||||
fprintf( stderr, "usage: %s -H <uri> | ([-h <host>] -p <port>) -D <manager> -w <passwd> -d <datadir> [-j <maxchild>] [-l <loops>] -P <progdir>\n", name );
|
||||
exit( EXIT_FAILURE );
|
||||
}
|
||||
|
||||
@ -68,13 +68,13 @@ main( int argc, char **argv )
|
||||
char *manager = NULL;
|
||||
char *passwd = NULL;
|
||||
char *dirname = NULL;
|
||||
char *sbase = NULL;
|
||||
char *progdir = NULL;
|
||||
char *loops = LOOPS;
|
||||
DIR *datadir;
|
||||
struct dirent *file;
|
||||
char *sfile = NULL;
|
||||
char *sreqs[MAXREQS];
|
||||
char *sbase[MAXREQS];
|
||||
int snum = 0;
|
||||
char *rfile = NULL;
|
||||
char *rreqs[MAXREQS];
|
||||
@ -119,10 +119,6 @@ main( int argc, char **argv )
|
||||
passwd = ArgDup( optarg );
|
||||
break;
|
||||
|
||||
case 'b': /* the base DN */
|
||||
sbase = ArgDup( optarg );
|
||||
break;
|
||||
|
||||
case 'd': /* data directory */
|
||||
dirname = strdup( optarg );
|
||||
break;
|
||||
@ -145,7 +141,7 @@ main( int argc, char **argv )
|
||||
}
|
||||
}
|
||||
|
||||
if (( dirname == NULL ) || ( sbase == NULL ) || ( port == NULL && uri == NULL ) ||
|
||||
if (( dirname == NULL ) || ( port == NULL && uri == NULL ) ||
|
||||
( manager == NULL ) || ( passwd == NULL ) || ( progdir == NULL ))
|
||||
usage( argv[0] );
|
||||
|
||||
@ -184,7 +180,7 @@ main( int argc, char **argv )
|
||||
|
||||
/* look for search requests */
|
||||
if ( sfile ) {
|
||||
snum = get_search_filters( sfile, sreqs );
|
||||
snum = get_search_filters( sfile, sreqs, sbase );
|
||||
}
|
||||
|
||||
/* look for read requests */
|
||||
@ -214,10 +210,10 @@ main( int argc, char **argv )
|
||||
sargs[sanum++] = "-p";
|
||||
sargs[sanum++] = port;
|
||||
}
|
||||
sargs[sanum++] = "-b";
|
||||
sargs[sanum++] = sbase;
|
||||
sargs[sanum++] = "-l";
|
||||
sargs[sanum++] = loops;
|
||||
sargs[sanum++] = "-b";
|
||||
sargs[sanum++] = NULL; /* will hold the search base */
|
||||
sargs[sanum++] = "-f";
|
||||
sargs[sanum++] = NULL; /* will hold the search request */
|
||||
sargs[sanum++] = NULL;
|
||||
@ -304,6 +300,7 @@ main( int argc, char **argv )
|
||||
if ( j < snum ) {
|
||||
|
||||
sargs[sanum - 2] = sreqs[j];
|
||||
sargs[sanum - 4] = sbase[j];
|
||||
fork_child( scmd, sargs );
|
||||
|
||||
}
|
||||
@ -348,7 +345,7 @@ get_file_name( char *dirname, char *filename )
|
||||
|
||||
|
||||
static int
|
||||
get_search_filters( char *filename, char *filters[] )
|
||||
get_search_filters( char *filename, char *filters[], char *bases[] )
|
||||
{
|
||||
FILE *fp;
|
||||
int filter = 0;
|
||||
@ -361,6 +358,11 @@ get_search_filters( char *filename, char *filters[] )
|
||||
|
||||
if (( nl = strchr( line, '\r' )) || ( nl = strchr( line, '\n' )))
|
||||
*nl = '\0';
|
||||
bases[filter] = ArgDup( line );
|
||||
fgets( line, BUFSIZ, fp );
|
||||
if (( nl = strchr( line, '\r' )) || ( nl = strchr( line, '\n' )))
|
||||
*nl = '\0';
|
||||
|
||||
filters[filter++] = ArgDup( line );
|
||||
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ for i in 0 1 2 3 4 5; do
|
||||
done
|
||||
|
||||
echo "Using tester for concurrent server access..."
|
||||
$SLAPDTESTER -b "$BASEDN" -P "$PROGDIR" -d "$DATADIR" -h $LOCALHOST -p $PORT -D "$MANAGERDN" -w $PASSWD -l 50
|
||||
$SLAPDTESTER -P "$PROGDIR" -d "$DATADIR" -h $LOCALHOST -p $PORT -D "$MANAGERDN" -w $PASSWD -l 50
|
||||
RC=$?
|
||||
|
||||
if test $RC != 0 ; then
|
||||
|
Loading…
Reference in New Issue
Block a user