From: Pierangelo Masarati Date: Sun, 6 Nov 2005 23:36:29 +0000 (+0000) Subject: silence warnings & FPE issue X-Git-Tag: OPENLDAP_REL_ENG_2_2_MP~74 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=161d648c8e2d5312a55379c164d94df35d0b8c9c;p=openldap silence warnings & FPE issue --- diff --git a/tests/progs/slapd-bind.c b/tests/progs/slapd-bind.c index e471c350eb..7f6d28e9ec 100644 --- a/tests/progs/slapd-bind.c +++ b/tests/progs/slapd-bind.c @@ -22,6 +22,7 @@ #include #include +#include #include #include @@ -52,7 +53,7 @@ do_base( char *uri, char *host, int port, char *base, char *pass, int maxloop ); static void usage( char *name ) { - fprintf( stderr, "usage: %s [-h ] -p port (-D |-b ) -w [-l ]\n", + fprintf( stderr, "usage: %s [-h ] -p port (-D |-b [-f ]) -w [-l ]\n", name ); exit( EXIT_FAILURE ); } @@ -64,14 +65,14 @@ main( int argc, char **argv ) { int i; char *uri = NULL; - char *host = "localhost"; + char *host = "localhost"; char *dn = NULL; char *base = NULL; char *pass = NULL; - int port = -1; - int loops = LOOPS; + int port = -1; + int loops = LOOPS; - while ( (i = getopt( argc, argv, "b:H:h:p:D:w:l:" )) != EOF ) { + while ( (i = getopt( argc, argv, "b:H:h:p:D:w:l:f:" )) != EOF ) { switch( i ) { case 'b': /* base DN of a tree of user DNs */ base = strdup( optarg ); @@ -100,6 +101,10 @@ main( int argc, char **argv ) loops = atoi( optarg ); break; + case 'f': + filter = optarg; + break; + default: usage( argv[0] ); break; @@ -121,8 +126,7 @@ static int do_bind( char *uri, char *host, int port, char *dn, char *pass, int maxloop ) { LDAP *ld = NULL; - int i, rc; - char *attrs[] = { "1.1", NULL }; + int i, rc = -1; pid_t pid = getpid(); if ( maxloop > 1 ) @@ -130,8 +134,6 @@ do_bind( char *uri, char *host, int port, char *dn, char *pass, int maxloop ) (long) pid, maxloop, dn ); for ( i = 0; i < maxloop; i++ ) { - LDAPMessage *res; - if ( uri ) { ldap_initialize( &ld, uri ); } else { @@ -244,6 +246,11 @@ do_base( char *uri, char *host, int port, char *base, char *pass, int maxloop ) } ldap_unbind( ld ); + if ( nrdns == 0 ) { + fprintf( stderr, "No RDNs.\n" ); + return 1; + } + beg = time(0L); /* Ok, got list of RDNs, now start binding to each */ for (i=0; i