mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-20 22:59:34 -05:00
silence warnings & FPE issue
This commit is contained in:
parent
e71b45fb69
commit
161d648c8e
1 changed files with 16 additions and 9 deletions
|
|
@ -22,6 +22,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include <ac/stdlib.h>
|
#include <ac/stdlib.h>
|
||||||
|
#include <ac/time.h>
|
||||||
|
|
||||||
#include <ac/ctype.h>
|
#include <ac/ctype.h>
|
||||||
#include <ac/param.h>
|
#include <ac/param.h>
|
||||||
|
|
@ -52,7 +53,7 @@ do_base( char *uri, char *host, int port, char *base, char *pass, int maxloop );
|
||||||
static void
|
static void
|
||||||
usage( char *name )
|
usage( char *name )
|
||||||
{
|
{
|
||||||
fprintf( stderr, "usage: %s [-h <host>] -p port (-D <dn>|-b <baseDN>) -w <passwd> [-l <loops>]\n",
|
fprintf( stderr, "usage: %s [-h <host>] -p port (-D <dn>|-b <baseDN> [-f <searchfilter>]) -w <passwd> [-l <loops>]\n",
|
||||||
name );
|
name );
|
||||||
exit( EXIT_FAILURE );
|
exit( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
|
|
@ -64,14 +65,14 @@ main( int argc, char **argv )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char *uri = NULL;
|
char *uri = NULL;
|
||||||
char *host = "localhost";
|
char *host = "localhost";
|
||||||
char *dn = NULL;
|
char *dn = NULL;
|
||||||
char *base = NULL;
|
char *base = NULL;
|
||||||
char *pass = NULL;
|
char *pass = NULL;
|
||||||
int port = -1;
|
int port = -1;
|
||||||
int loops = LOOPS;
|
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 ) {
|
switch( i ) {
|
||||||
case 'b': /* base DN of a tree of user DNs */
|
case 'b': /* base DN of a tree of user DNs */
|
||||||
base = strdup( optarg );
|
base = strdup( optarg );
|
||||||
|
|
@ -100,6 +101,10 @@ main( int argc, char **argv )
|
||||||
loops = atoi( optarg );
|
loops = atoi( optarg );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'f':
|
||||||
|
filter = optarg;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
usage( argv[0] );
|
usage( argv[0] );
|
||||||
break;
|
break;
|
||||||
|
|
@ -121,8 +126,7 @@ static int
|
||||||
do_bind( char *uri, char *host, int port, char *dn, char *pass, int maxloop )
|
do_bind( char *uri, char *host, int port, char *dn, char *pass, int maxloop )
|
||||||
{
|
{
|
||||||
LDAP *ld = NULL;
|
LDAP *ld = NULL;
|
||||||
int i, rc;
|
int i, rc = -1;
|
||||||
char *attrs[] = { "1.1", NULL };
|
|
||||||
pid_t pid = getpid();
|
pid_t pid = getpid();
|
||||||
|
|
||||||
if ( maxloop > 1 )
|
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 );
|
(long) pid, maxloop, dn );
|
||||||
|
|
||||||
for ( i = 0; i < maxloop; i++ ) {
|
for ( i = 0; i < maxloop; i++ ) {
|
||||||
LDAPMessage *res;
|
|
||||||
|
|
||||||
if ( uri ) {
|
if ( uri ) {
|
||||||
ldap_initialize( &ld, uri );
|
ldap_initialize( &ld, uri );
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -244,6 +246,11 @@ do_base( char *uri, char *host, int port, char *base, char *pass, int maxloop )
|
||||||
}
|
}
|
||||||
ldap_unbind( ld );
|
ldap_unbind( ld );
|
||||||
|
|
||||||
|
if ( nrdns == 0 ) {
|
||||||
|
fprintf( stderr, "No RDNs.\n" );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
beg = time(0L);
|
beg = time(0L);
|
||||||
/* Ok, got list of RDNs, now start binding to each */
|
/* Ok, got list of RDNs, now start binding to each */
|
||||||
for (i=0; i<maxloop; i++) {
|
for (i=0; i<maxloop; i++) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue