LDAP *ld = NULL;
int i;
pid_t pid = getpid();
+ int rc = LDAP_SUCCESS;
if ( uri ) {
ldap_initialize( &ld, uri );
for ( i = 0; i < maxloop; i++ ) {
/* add the entry */
- if ( ldap_add_s( ld, entry, attrs ) != LDAP_SUCCESS ) {
-
+ rc = ldap_add_s( ld, entry, attrs );
+ if ( rc != LDAP_SUCCESS ) {
ldap_perror( ld, "ldap_add" );
break;
#endif
/* now delete the entry again */
- if ( ldap_delete_s( ld, entry ) != LDAP_SUCCESS ) {
-
+ rc = ldap_delete_s( ld, entry );
+ if ( rc != LDAP_SUCCESS ) {
ldap_perror( ld, "ldap_delete" );
break;
}
- fprintf( stderr, " PID=%ld - Add/Delete done.\n", (long) pid );
+ fprintf( stderr, " PID=%ld - Add/Delete done (%d).\n", (long) pid, rc );
ldap_unbind( ld );
}
LDAP *ld = NULL;
int i;
pid_t pid;
+ int rc = LDAP_SUCCESS;
struct ldapmod mod;
struct ldapmod *mods[2];
(long) pid, maxloop, entry );
for ( i = 0; i < maxloop; i++ ) {
- int rc;
-
mod.mod_op = LDAP_MOD_ADD;
if (( rc = ldap_modify_s( ld, entry, mods )) != LDAP_SUCCESS ) {
ldap_perror( ld, "ldap_modify" );
}
- fprintf( stderr, " PID=%ld - Modify done.\n", (long) pid );
+ fprintf( stderr, " PID=%ld - Modify done (%d).\n", (long) pid, rc );
ldap_unbind( ld );
}
pid_t pid;
char *DNs[2];
char *rdns[2];
+ int rc = LDAP_SUCCESS;
+
pid = getpid();
DNs[0] = entry;
(long) pid, maxloop, entry );
for ( i = 0; i < maxloop; i++ ) {
- int rc;
-
if (( rc = ldap_modrdn2_s( ld, DNs[0], rdns[0], 0 ))
!= LDAP_SUCCESS ) {
ldap_perror( ld, "ldap_modrdn" );
}
}
- fprintf( stderr, " PID=%ld - Modrdn done.\n", (long) pid );
+ fprintf( stderr, " PID=%ld - Modrdn done (%d).\n", (long) pid, rc );
ldap_unbind( ld );
}
int i;
char *attrs[] = { "1.1", NULL };
pid_t pid = getpid();
+ int rc = LDAP_SUCCESS;
if ( uri ) {
ldap_initialize( &ld, uri );
for ( i = 0; i < maxloop; i++ ) {
LDAPMessage *res;
- int rc;
-
- if (( rc = ldap_search_s( ld, entry, LDAP_SCOPE_BASE,
- NULL, attrs, 1, &res )) != LDAP_SUCCESS ) {
+ rc = ldap_search_s( ld, entry, LDAP_SCOPE_BASE,
+ NULL, attrs, 1, &res );
+ if ( rc != LDAP_SUCCESS ) {
ldap_perror( ld, "ldap_read" );
if ( rc != LDAP_NO_SUCH_OBJECT ) break;
continue;
ldap_msgfree( res );
}
- fprintf( stderr, " PID=%ld - Read done.\n", (long) pid );
+ fprintf( stderr, " PID=%ld - Read done (%d).\n", (long) pid, rc );
ldap_unbind( ld );
}
#define LOOPS 100
static void
-do_search( char *uri, char *host, int port, char *sbase, char *filter, int maxloop );
+do_search( char *uri, char *host, int port, char *manager, char *passwd, char *sbase, char *filter, int maxloop );
static void
usage( char *name )
char *uri = NULL;
char *host = "localhost";
int port = -1;
+ char *manager = NULL;
+ char *passwd = NULL;
char *sbase = NULL;
char *filter = NULL;
int loops = LOOPS;
- while ( (i = getopt( argc, argv, "H:h:p:b:f:l:" )) != EOF ) {
+ while ( (i = getopt( argc, argv, "b:D:f:H:h:l:p:w:" )) != EOF ) {
switch( i ) {
case 'H': /* the server uri */
uri = strdup( optarg );
port = atoi( optarg );
break;
+ case 'D': /* the servers manager */
+ manager = strdup( optarg );
+ break;
+
+ case 'w': /* the server managers password */
+ passwd = strdup( optarg );
+ break;
+
case 'b': /* file with search base */
sbase = strdup( optarg );
break;
}
- do_search( uri, host, port, sbase, filter, ( 10 * loops ));
+ do_search( uri, host, port, manager, passwd, sbase, filter, ( 10 * loops ));
exit( EXIT_SUCCESS );
}
static void
-do_search( char *uri, char *host, int port, char *sbase, char *filter, int maxloop )
+do_search( char *uri, char *host, int port, char *manager, char *passwd, char *sbase, char *filter, int maxloop )
{
LDAP *ld = NULL;
int i;
char *attrs[] = { "cn", "sn", NULL };
pid_t pid = getpid();
+ int rc = LDAP_SUCCESS;
if ( uri ) {
ldap_initialize( &ld, uri );
&version );
}
- if ( ldap_bind_s( ld, NULL, NULL, LDAP_AUTH_SIMPLE ) != LDAP_SUCCESS ) {
+ if ( ldap_bind_s( ld, manager, passwd, LDAP_AUTH_SIMPLE ) != LDAP_SUCCESS ) {
ldap_perror( ld, "ldap_bind" );
exit( EXIT_FAILURE );
}
for ( i = 0; i < maxloop; i++ ) {
LDAPMessage *res;
- int rc;
-
- if (( rc = ldap_search_s( ld, sbase, LDAP_SCOPE_SUBTREE,
- filter, attrs, 0, &res )) != LDAP_SUCCESS ) {
+ rc = ldap_search_s( ld, sbase, LDAP_SCOPE_SUBTREE,
+ filter, attrs, 0, &res );
+ if ( rc != LDAP_SUCCESS ) {
ldap_perror( ld, "ldap_search" );
if ( rc != LDAP_NO_SUCH_OBJECT ) break;
continue;
ldap_msgfree( res );
}
- fprintf( stderr, " PID=%ld - Search done.\n", (long) pid );
+ fprintf( stderr, " PID=%ld - Search done (%d).\n", (long) pid, rc );
ldap_unbind( ld );
}
#define ADDCMD "slapd-addel"
#define MODRDNCMD "slapd-modrdn"
#define MODIFYCMD "slapd-modify"
-#define MAXARGS 100
-#define MAXREQS 20
+#define MAXARGS 100
+#define MAXREQS 5000
#define LOOPS "100"
#define TSEARCHFILE "do_search.0"
sargs[sanum++] = "-p";
sargs[sanum++] = port;
}
+ sargs[sanum++] = "-D";
+ sargs[sanum++] = manager;
+ sargs[sanum++] = "-w";
+ sargs[sanum++] = passwd;
sargs[sanum++] = "-l";
sargs[sanum++] = loops;
sargs[sanum++] = "-b";