]> git.sur5r.net Git - openldap/commitdiff
allow selective handling of errors
authorPierangelo Masarati <ando@openldap.org>
Fri, 9 Jun 2006 09:30:36 +0000 (09:30 +0000)
committerPierangelo Masarati <ando@openldap.org>
Fri, 9 Jun 2006 09:30:36 +0000 (09:30 +0000)
tests/progs/slapd-addel.c
tests/progs/slapd-bind.c
tests/progs/slapd-common.c
tests/progs/slapd-common.h
tests/progs/slapd-modify.c
tests/progs/slapd-modrdn.c
tests/progs/slapd-read.c
tests/progs/slapd-search.c
tests/progs/slapd-tester.c

index ff131b1879bbec38583c3deb72c7d750d63431e6..5414fc8337d8542641c6bb129f65fba9d05c25c7 100644 (file)
@@ -55,6 +55,7 @@ usage( char *name )
                "-D <manager> "
                "-w <passwd> "
                "-f <addfile> "
+               "[-i <ignore>] "
                "[-l <loops>] "
                "[-L <outerloops>] "
                "[-r <maxretries>] "
@@ -84,7 +85,7 @@ main( int argc, char **argv )
        int             chaserefs = 0;
        LDAPMod         **attrs = NULL;
 
-       tester_init( "slapd-modify" );
+       tester_init( "slapd-addel", TESTER_ADDEL );
 
        while ( (i = getopt( argc, argv, "CFH:h:p:D:w:f:l:L:r:t:" )) != EOF ) {
                switch( i ) {
@@ -104,6 +105,10 @@ main( int argc, char **argv )
                        host = strdup( optarg );
                        break;
 
+               case 'i':
+                       /* ignored (!) by now */
+                       break;
+
                case 'p':               /* the servers port */
                        if ( lutil_atoi( &port, optarg ) != 0 ) {
                                usage( argv[0] );
index 5ede6aa934d48bb4c7f2187ea535e23b80540803..7bc02baae681ac15a08a4d7f603dfcfe8e067b50 100644 (file)
@@ -67,6 +67,7 @@ usage( char *name )
                "[-F] "
                "[-C] "
                "[-I] "
+               "[-i <ignore>] "
                "[-t delay]\n",
                name );
        exit( EXIT_FAILURE );
@@ -92,9 +93,12 @@ main( int argc, char **argv )
        int             noinit = 0;
        int             delay = 0;
 
-       tester_init( "slapd-bind" );
+       tester_init( "slapd-bind", TESTER_BIND );
 
-       while ( (i = getopt( argc, argv, "a:b:H:h:p:D:w:l:L:f:FIt:" )) != EOF ) {
+       /* by default, tolerate invalid credentials */
+       tester_ignore_str2errlist( "INVALID_CREDENTIALS" );
+
+       while ( (i = getopt( argc, argv, "a:b:H:h:i:p:D:w:l:L:f:FIt:" )) != EOF ) {
                switch( i ) {
                case 'a':
                        pwattr = optarg;
@@ -116,6 +120,10 @@ main( int argc, char **argv )
                        host = optarg;
                        break;
 
+               case 'i':
+                       tester_ignore_str2errlist( optarg );
+                       break;
+
                case 'p':               /* the servers port */
                        if ( lutil_atoi( &port, optarg ) != 0 ) {
                                usage( argv[0] );
@@ -193,7 +201,7 @@ do_bind( char *uri, char *dn, struct berval *pass, int maxloop,
        int force, int chaserefs, int noinit, LDAP **ldp )
 {
        LDAP    *ld = ldp ? *ldp : NULL;
-       int     i, first = 1, rc = -1;
+       int     i, rc = -1;
        pid_t   pid = getpid();
 
        if ( maxloop > 1 )
@@ -217,29 +225,28 @@ do_bind( char *uri, char *dn, struct berval *pass, int maxloop,
                }
 
                rc = ldap_sasl_bind_s( ld, dn, LDAP_SASL_SIMPLE, pass, NULL, NULL, NULL );
-               switch ( rc ) {
-               case LDAP_SUCCESS:
-                       break;
-
-               case LDAP_INVALID_CREDENTIALS:
-                       /* don't log: it's intended */
-                       if ( force >= 2 ) {
-                               if ( !first ) {
-                                       break;
+               if ( rc ) {
+                       unsigned first = tester_ignore_err( rc );
+
+                       /* if ignore.. */
+                       if ( first ) {
+                               /* only log if first occurrence */
+                               if ( force < 2 || first == 1 ) {
+                                       tester_ldap_error( ld, "ldap_sasl_bind_s", NULL );
                                }
-                               first = 0;
-                       }
-                       /* fallthru */
+                               rc = LDAP_SUCCESS;
 
-               default:
-                       tester_ldap_error( ld, "ldap_sasl_bind_s", NULL );
+                       } else {
+                               tester_ldap_error( ld, "ldap_sasl_bind_s", NULL );
+                       }
                }
-
+                       
                if ( !noinit ) {
                        ldap_unbind_ext( ld, NULL, NULL );
                        ld = NULL;
                }
-               if ( rc != LDAP_SUCCESS && !force ) {
+
+               if ( rc != LDAP_SUCCESS ) {
                        break;
                }
        }
index 3724794a8b1797fc32b93e31c24d295ed656bf62..3c98adb0151f3d41d58747cf3d1d135cb9a8f27d 100644 (file)
 
 #include <ldap.h>
 
+#include "ldap_pvt.h"
+#include "slapd-common.h"
+
 static char progname[ BUFSIZ ];
+tester_t progtype;
+
+#define        TESTER_SERVER_LAST      (LDAP_OTHER + 1)
+#define TESTER_CLIENT_LAST     (- LDAP_REFERRAL_LIMIT_EXCEEDED + 1)
+static unsigned ignore_server[ TESTER_SERVER_LAST ];
+static unsigned ignore_client[ TESTER_CLIENT_LAST ];
+
+static struct {
+       char    *name;
+       int     err;
+} ignore_str2err[] = {
+       { "OPERATIONS_ERROR",           LDAP_OPERATIONS_ERROR },
+       { "PROTOCOL_ERROR",             LDAP_PROTOCOL_ERROR },
+       { "TIMELIMIT_EXCEEDED",         LDAP_TIMELIMIT_EXCEEDED },
+       { "SIZELIMIT_EXCEEDED",         LDAP_SIZELIMIT_EXCEEDED },
+       { "COMPARE_FALSE",              LDAP_COMPARE_FALSE },
+       { "COMPARE_TRUE",               LDAP_COMPARE_TRUE },
+       { "AUTH_METHOD_NOT_SUPPORTED",  LDAP_AUTH_METHOD_NOT_SUPPORTED },
+       { "STRONG_AUTH_NOT_SUPPORTED",  LDAP_STRONG_AUTH_NOT_SUPPORTED },
+       { "STRONG_AUTH_REQUIRED",       LDAP_STRONG_AUTH_REQUIRED },
+       { "STRONGER_AUTH_REQUIRED",     LDAP_STRONGER_AUTH_REQUIRED },
+       { "PARTIAL_RESULTS",            LDAP_PARTIAL_RESULTS },
+
+       { "REFERRAL",                   LDAP_REFERRAL },
+       { "ADMINLIMIT_EXCEEDED",        LDAP_ADMINLIMIT_EXCEEDED },
+       { "UNAVAILABLE_CRITICAL_EXTENSION", LDAP_UNAVAILABLE_CRITICAL_EXTENSION },
+       { "CONFIDENTIALITY_REQUIRED",   LDAP_CONFIDENTIALITY_REQUIRED },
+       { "SASL_BIND_IN_PROGRESS",      LDAP_SASL_BIND_IN_PROGRESS },
+
+       { "NO_SUCH_ATTRIBUTE",          LDAP_NO_SUCH_ATTRIBUTE },
+       { "UNDEFINED_TYPE",             LDAP_UNDEFINED_TYPE },
+       { "INAPPROPRIATE_MATCHING",     LDAP_INAPPROPRIATE_MATCHING },
+       { "CONSTRAINT_VIOLATION",       LDAP_CONSTRAINT_VIOLATION },
+       { "TYPE_OR_VALUE_EXISTS",       LDAP_TYPE_OR_VALUE_EXISTS },
+       { "INVALID_SYNTAX",             LDAP_INVALID_SYNTAX },
+
+       { "NO_SUCH_OBJECT",             LDAP_NO_SUCH_OBJECT },
+       { "ALIAS_PROBLEM",              LDAP_ALIAS_PROBLEM },
+       { "INVALID_DN_SYNTAX",          LDAP_INVALID_DN_SYNTAX },
+       { "IS_LEAF",                    LDAP_IS_LEAF },
+       { "ALIAS_DEREF_PROBLEM",        LDAP_ALIAS_DEREF_PROBLEM },
+
+       { "PROXY_AUTHZ_FAILURE",        LDAP_PROXY_AUTHZ_FAILURE },
+       { "INAPPROPRIATE_AUTH",         LDAP_INAPPROPRIATE_AUTH },
+       { "INVALID_CREDENTIALS",        LDAP_INVALID_CREDENTIALS },
+       { "INSUFFICIENT_ACCESS",        LDAP_INSUFFICIENT_ACCESS },
+
+       { "BUSY",                       LDAP_BUSY },
+       { "UNAVAILABLE",                LDAP_UNAVAILABLE },
+       { "UNWILLING_TO_PERFORM",       LDAP_UNWILLING_TO_PERFORM },
+       { "LOOP_DETECT",                LDAP_LOOP_DETECT },
+
+       { "NAMING_VIOLATION",           LDAP_NAMING_VIOLATION },
+       { "OBJECT_CLASS_VIOLATION",     LDAP_OBJECT_CLASS_VIOLATION },
+       { "NOT_ALLOWED_ON_NONLEAF",     LDAP_NOT_ALLOWED_ON_NONLEAF },
+       { "NOT_ALLOWED_ON_RDN",         LDAP_NOT_ALLOWED_ON_RDN },
+       { "ALREADY_EXISTS",             LDAP_ALREADY_EXISTS },
+       { "NO_OBJECT_CLASS_MODS",       LDAP_NO_OBJECT_CLASS_MODS },
+       { "RESULTS_TOO_LARGE",          LDAP_RESULTS_TOO_LARGE },
+       { "AFFECTS_MULTIPLE_DSAS",      LDAP_AFFECTS_MULTIPLE_DSAS },
+
+       { "OTHER",                      LDAP_OTHER },
+
+       { "SERVER_DOWN",                LDAP_SERVER_DOWN },
+       { "LOCAL_ERROR",                LDAP_LOCAL_ERROR },
+       { "ENCODING_ERROR",             LDAP_ENCODING_ERROR },
+       { "DECODING_ERROR",             LDAP_DECODING_ERROR },
+       { "TIMEOUT",                    LDAP_TIMEOUT },
+       { "AUTH_UNKNOWN",               LDAP_AUTH_UNKNOWN },
+       { "FILTER_ERROR",               LDAP_FILTER_ERROR },
+       { "USER_CANCELLED",             LDAP_USER_CANCELLED },
+       { "PARAM_ERROR",                LDAP_PARAM_ERROR },
+       { "NO_MEMORY",                  LDAP_NO_MEMORY },
+       { "CONNECT_ERROR",              LDAP_CONNECT_ERROR },
+       { "NOT_SUPPORTED",              LDAP_NOT_SUPPORTED },
+       { "CONTROL_NOT_FOUND",          LDAP_CONTROL_NOT_FOUND },
+       { "NO_RESULTS_RETURNED",        LDAP_NO_RESULTS_RETURNED },
+       { "MORE_RESULTS_TO_RETURN",     LDAP_MORE_RESULTS_TO_RETURN },
+       { "CLIENT_LOOP",                LDAP_CLIENT_LOOP },
+       { "REFERRAL_LIMIT_EXCEEDED",    LDAP_REFERRAL_LIMIT_EXCEEDED },
+
+       { NULL }
+};
+
+#define UNKNOWN_ERR    (1234567890)
+
+static int
+tester_ignore_str2err( const char *err )
+{
+       int             i;
+       unsigned        ignore = 1;
+
+       if ( strcmp( err, "ALL" ) == 0 ) {
+               for ( i = 0; ignore_str2err[ i ].name != NULL; i++ ) {
+                       int     err = ignore_str2err[ i ].err;
+
+                       if ( err > 0 ) {
+                               ignore_server[ err ] = 1;
+
+                       } else if ( err < 0 ) {
+                               ignore_client[ -err ] = 1;
+                       }
+               }
+
+               return 0;
+       }
+
+       if ( err[ 0 ] == '!' ) {
+               ignore = 0;
+               err++;
+       }
+
+       for ( i = 0; ignore_str2err[ i ].name != NULL; i++ ) {
+               if ( strcmp( err, ignore_str2err[ i ].name ) == 0 ) {
+                       int     err = ignore_str2err[ i ].err;
+
+                       if ( err > 0 ) {
+                               ignore_server[ err ] = ignore;
+
+                       } else if ( err < 0 ) {
+                               ignore_client[ -err ] = ignore;
+                       }
+
+                       return err;
+               }
+       }
+
+       return UNKNOWN_ERR;
+}
+
+int
+tester_ignore_str2errlist( const char *err )
+{
+       int     i;
+       char    **errs = ldap_str2charray( err, "," );
+
+       for ( i = 0; errs[ i ] != NULL; i++ ) {
+               /* TODO: allow <err>:<prog> to ignore <err> only when <prog> */
+               (void)tester_ignore_str2err( errs[ i ] );
+       }
+
+       ldap_charray_free( errs );
+
+       return 0;
+}
+
+unsigned
+tester_ignore_err( int err )
+{
+       unsigned        rc = 1;
+
+       if ( err > 0 ) {
+               if ( err < TESTER_SERVER_LAST ) {
+                       rc = ignore_server[ err ];
+                       if ( rc ) {
+                               ignore_server[ err ]++;
+                       }
+               }
+
+       } else if ( err < 0 ) {
+               if ( -err < TESTER_CLIENT_LAST ) {
+                       rc = ignore_client[ -err ];
+                       if ( rc ) {
+                               ignore_client[ -err ]++;
+                       }
+               }
+       }
+
+       /* SUCCESS is always "ignored" */
+       return rc;
+}
 
 void
-tester_init( const char *pname )
+tester_init( const char *pname, tester_t ptype )
 {
        snprintf( progname, sizeof( progname ), "%s PID=%d", pname, getpid() );
+       progtype = ptype;
 }
 
 char *
index e1142ead0a8c285a404cbc2c5b405ddf8e3ecdf6..e42e8080a655ebe6d7f64c1e451f95bec6b0db51 100644 (file)
 #ifndef SLAPD_COMMON_H
 #define SLAPD_COMMON_H
 
-extern void tester_init( const char *pname );
+typedef enum {
+       TESTER_TESTER,
+       TESTER_ADDEL,
+       TESTER_BIND,
+       TESTER_MODIFY,
+       TESTER_MODRDN,
+       TESTER_READ,
+       TESTER_SEARCH
+} tester_t;
+
+extern void tester_init( const char *pname, tester_t ptype );
 extern char * tester_uri( char *uri, char *host, int port );
 extern void tester_error( const char *msg );
 extern void tester_perror( const char *fname, const char *msg );
 extern void tester_ldap_error( LDAP *ld, const char *fname, const char *msg );
+extern int tester_ignore_str2errlist( const char *err );
+extern unsigned tester_ignore_err( int err );
 
 #endif /* SLAPD_COMMON_H */
index 887d9462db30743275751ac6c28811fbf998c809..04cfef116c68845493721b846cf03cc044b35cf7 100644 (file)
@@ -49,6 +49,7 @@ usage( char *name )
                "-D <manager> "
                "-w <passwd> "
                "-e <entry> "
+               "[-i <ignore>] "
                "[-l <loops>] "
                "[-L <outerloops>] "
                "[-r <maxretries>] "
@@ -78,9 +79,9 @@ main( int argc, char **argv )
        int             friendly = 0;
        int             chaserefs = 0;
 
-       tester_init( "slapd-modify" );
+       tester_init( "slapd-modify", TESTER_MODIFY );
 
-       while ( (i = getopt( argc, argv, "CFH:h:p:D:w:e:a:l:L:r:t:" )) != EOF ) {
+       while ( (i = getopt( argc, argv, "CFH:h:i:p:D:w:e:a:l:L:r:t:" )) != EOF ) {
                switch ( i ) {
                case 'C':
                        chaserefs++;
@@ -98,6 +99,10 @@ main( int argc, char **argv )
                        host = strdup( optarg );
                        break;
 
+               case 'i':
+                       /* ignored (!) by now */
+                       break;
+
                case 'p':               /* the servers port */
                        if ( lutil_atoi( &port, optarg ) != 0 ) {
                                usage( argv[0] );
index 515e58efca2a4cd361096c7c0fa249650feef611..4bfec6120361d845c40c781fe2bc2230323cb000 100644 (file)
@@ -52,6 +52,7 @@ usage( char *name )
                "-D <manager> "
                "-w <passwd> "
                "-e <entry> "
+               "[-i <ignore>] "
                "[-l <loops>] "
                "[-L <outerloops>] "
                "[-r <maxretries>] "
@@ -79,9 +80,9 @@ main( int argc, char **argv )
        int             friendly = 0;
        int             chaserefs = 0;
 
-       tester_init( "slapd-modrdn" );
+       tester_init( "slapd-modrdn", TESTER_MODRDN );
 
-       while ( (i = getopt( argc, argv, "CFH:h:p:D:w:e:l:L:r:t:" )) != EOF ) {
+       while ( (i = getopt( argc, argv, "CFH:h:i:p:D:w:e:l:L:r:t:" )) != EOF ) {
                switch( i ) {
                case 'C':
                        chaserefs++;
@@ -99,6 +100,10 @@ main( int argc, char **argv )
                        host = strdup( optarg );
                        break;
 
+               case 'i':
+                       /* ignored (!) by now */
+                       break;
+
                case 'p':               /* the servers port */
                        if ( lutil_atoi( &port, optarg ) != 0 ) {
                                usage( argv[0] );
index dc67d5ad773b406396ab2c8ddbeaeb88e32febce..36abbc79677ebb253b474b3cd43d8b803b946062 100644 (file)
@@ -61,6 +61,7 @@ usage( char *name )
                "[-C] "
                "[-F] "
                "[-f filter] "
+               "[-i <ignore>] "
                "[-l <loops>] "
                "[-L <outerloops>] "
                "[-r <maxretries>] "
@@ -88,9 +89,12 @@ main( int argc, char **argv )
        int             chaserefs = 0;
        int             noattrs = 0;
 
-       tester_init( "slapd-read" );
+       tester_init( "slapd-read", TESTER_READ );
 
-       while ( (i = getopt( argc, argv, "ACD:H:h:p:e:Ff:l:L:r:t:w:" )) != EOF ) {
+       /* by default, tolerate referrals and no such object */
+       tester_ignore_str2errlist( "REFERRAL,NO_SUCH_OBJECT" );
+
+       while ( (i = getopt( argc, argv, "ACD:H:h:i:p:e:Ff:l:L:r:t:w:" )) != EOF ) {
                switch( i ) {
                case 'A':
                        noattrs++;
@@ -108,6 +112,10 @@ main( int argc, char **argv )
                        host = strdup( optarg );
                        break;
 
+               case 'i':
+                       tester_ignore_str2errlist( optarg );
+                       break;
+
                case 'p':               /* the servers port */
                        if ( lutil_atoi( &port, optarg ) != 0 ) {
                                usage( argv[0] );
@@ -294,7 +302,6 @@ do_read( char *uri, char *manager, struct berval *passwd, char *entry,
        pid_t   pid = getpid();
        int     rc = LDAP_SUCCESS;
        int     version = LDAP_VERSION3;
-       int     first = 1;
 
 retry:;
        if ( ld == NULL ) {
@@ -341,39 +348,33 @@ retry:;
                rc = ldap_search_ext_s( ld, entry, LDAP_SCOPE_BASE,
                                NULL, attrs, noattrs, NULL, NULL, NULL,
                                LDAP_NO_LIMIT, &res );
-               switch ( rc ) {
-               case LDAP_REFERRAL:
-                       /* don't log: it's intended */
-                       if ( force >= 2 ) {
-                               if ( !first ) {
-                                       break;
+               if ( res != NULL ) {
+                       ldap_msgfree( res );
+               }
+
+               if ( rc ) {
+                       unsigned first = tester_ignore_err( rc );
+                       /* if ignore.. */
+                       if ( first ) {
+                               /* only log if first occurrence */
+                               if ( force < 2 || first == 1 ) {
+                                       tester_ldap_error( ld, "ldap_search_ext_s", NULL );
                                }
-                               first = 0;
+                               continue;
                        }
-                       tester_ldap_error( ld, "ldap_search_ext_s", NULL );
-                       /* fallthru */
-
-               case LDAP_SUCCESS:
-                       break;
 
-               default:
+                       /* busy needs special handling */
                        tester_ldap_error( ld, "ldap_search_ext_s", NULL );
                        if ( rc == LDAP_BUSY && do_retry > 0 ) {
+                               ldap_unbind_ext( ld, NULL, NULL );
+                               ld = NULL;
                                do_retry--;
                                goto retry;
                        }
-                       if ( rc != LDAP_NO_SUCH_OBJECT ) {
-                               goto done;
-                       }
                        break;
                }
-
-               if ( res != NULL ) {
-                       ldap_msgfree( res );
-               }
        }
 
-done:;
        if ( ldp != NULL ) {
                *ldp = ld;
 
index d9407e9fe4dd3061ba34b5025867daadf168e9a7..767a4623c98306fd7a74658833c86103a6cca2ca 100644 (file)
@@ -62,6 +62,7 @@ usage( char *name )
                "[-A] "
                "[-C] "
                "[-F] "
+               "[-i <ignore>] "
                "[-l <loops>] "
                "[-L <outerloops>] "
                "[-r <maxretries>] "
@@ -90,9 +91,12 @@ main( int argc, char **argv )
        int             chaserefs = 0;
        int             noattrs = 0;
 
-       tester_init( "slapd-search" );
+       tester_init( "slapd-search", TESTER_SEARCH );
 
-       while ( (i = getopt( argc, argv, "Aa:b:CD:f:FH:h:l:L:p:w:r:t:" )) != EOF ) {
+       /* by default, tolerate referrals and no such object */
+       tester_ignore_str2errlist( "REFERRAL,NO_SUCH_OBJECT" );
+
+       while ( (i = getopt( argc, argv, "Aa:b:CD:f:FH:h:i:l:L:p:w:r:t:" )) != EOF ) {
                switch( i ) {
                case 'A':
                        noattrs++;
@@ -110,6 +114,10 @@ main( int argc, char **argv )
                        host = strdup( optarg );
                        break;
 
+               case 'i':
+                       tester_ignore_str2errlist( optarg );
+                       break;
+
                case 'p':               /* the servers port */
                        if ( lutil_atoi( &port, optarg ) != 0 ) {
                                usage( argv[0] );
@@ -316,7 +324,6 @@ do_search( char *uri, char *manager, struct berval *passwd,
        pid_t   pid = getpid();
        int     rc = LDAP_SUCCESS;
        int     version = LDAP_VERSION3;
-       int     first = 1;
        char    buf[ BUFSIZ ];
 
 
@@ -371,39 +378,32 @@ retry:;
                        ldap_msgfree( res );
                }
 
-               switch ( rc ) {
-               case LDAP_REFERRAL:
-                       /* don't log: it's intended */
-                       if ( force >= 2 ) {
-                               if ( !first ) {
-                                       break;
+               if ( rc ) {
+                       unsigned first = tester_ignore_err( rc );
+                       /* if ignore.. */
+                       if ( first ) {
+                               /* only log if first occurrence */
+                               if ( force < 2 || first == 1 ) {
+                                       tester_ldap_error( ld, "ldap_search_ext_s", NULL );
                                }
-                               first = 0;
+                               continue;
                        }
-                       tester_ldap_error( ld, "ldap_search_ext_s", NULL );
-                       /* fallthru */
 
-               case LDAP_SUCCESS:
-                       break;
-
-               default:
+                       /* busy needs special handling */
                        snprintf( buf, sizeof( buf ),
                                "base=\"%s\" filter=\"%s\"\n",
                                sbase, filter );
                        tester_ldap_error( ld, "ldap_search_ext_s", buf );
                        if ( rc == LDAP_BUSY && do_retry > 0 ) {
                                ldap_unbind_ext( ld, NULL, NULL );
+                               ld = NULL;
                                do_retry--;
                                goto retry;
                        }
-                       if ( rc != LDAP_NO_SUCH_OBJECT ) {
-                               goto done;
-                       }
                        break;
                }
        }
 
-done:;
        if ( ldp != NULL ) {
                *ldp = ld;
 
index ad773a6ea084ff94b9d99dd2a348406232bcd7c6..cfb84a70a844e2455e780f978cf55465bdb46b8c 100644 (file)
@@ -83,6 +83,7 @@ usage( char *name )
                "-D <manager> "
                "-w <passwd> "
                "-d <datadir> "
+               "[-i <ignore>] "
                "[-j <maxchild>] "
                "[-l <loops>] "
                "[-L <outerloops>] "
@@ -115,6 +116,7 @@ main( int argc, char **argv )
        int             friendly = 0;
        int             chaserefs = 0;
        int             noattrs = 0;
+       char            *ignore = NULL;
        /* search */
        char            *sfile = NULL;
        char            *sreqs[MAXREQS];
@@ -171,9 +173,9 @@ main( int argc, char **argv )
 
        char            *friendlyOpt = NULL;
 
-       tester_init( "slapd-tester" );
+       tester_init( "slapd-tester", TESTER_TESTER );
 
-       while ( (i = getopt( argc, argv, "ACD:d:FH:h:j:l:L:P:p:r:t:w:" )) != EOF ) {
+       while ( (i = getopt( argc, argv, "ACD:d:FH:h:i:j:l:L:P:p:r:t:w:" )) != EOF ) {
                switch( i ) {
                case 'A':
                        noattrs++;
@@ -203,6 +205,10 @@ main( int argc, char **argv )
                        host = strdup( optarg );
                        break;
 
+               case 'i':
+                       ignore = optarg;
+                       break;
+
                case 'j':               /* the number of parallel clients */
                        if ( lutil_atoi( &maxkids, optarg ) != 0 ) {
                                usage( argv[0] );
@@ -375,6 +381,10 @@ main( int argc, char **argv )
        if ( noattrs ) {
                sargs[sanum++] = "-A";
        }
+       if ( ignore ) {
+               sargs[sanum++] = "-i";
+               sargs[sanum++] = ignore;
+       }
        sargs[sanum++] = "-b";
        sargs[sanum++] = NULL;          /* will hold the search base */
        sargs[sanum++] = "-f";
@@ -423,6 +433,10 @@ main( int argc, char **argv )
        if ( noattrs ) {
                rargs[ranum++] = "-A";
        }
+       if ( ignore ) {
+               rargs[ranum++] = "-i";
+               rargs[ranum++] = ignore;
+       }
        rargs[ranum++] = "-e";
        rargs[ranum++] = NULL;          /* will hold the read entry */
 
@@ -466,6 +480,10 @@ main( int argc, char **argv )
        if ( chaserefs ) {
                margs[manum++] = "-C";
        }
+       if ( ignore ) {
+               margs[manum++] = "-i";
+               margs[manum++] = ignore;
+       }
        margs[manum++] = "-e";
        margs[manum++] = NULL;          /* will hold the modrdn entry */
        margs[manum++] = NULL;
@@ -505,6 +523,10 @@ main( int argc, char **argv )
        if ( chaserefs ) {
                modargs[modanum++] = "-C";
        }
+       if ( ignore ) {
+               modargs[modanum++] = "-i";
+               modargs[modanum++] = ignore;
+       }
        modargs[modanum++] = "-e";
        modargs[modanum++] = NULL;              /* will hold the modify entry */
        modargs[modanum++] = "-a";;
@@ -546,6 +568,10 @@ main( int argc, char **argv )
        if ( chaserefs ) {
                aargs[aanum++] = "-C";
        }
+       if ( ignore ) {
+               aargs[aanum++] = "-i";
+               aargs[aanum++] = ignore;
+       }
        aargs[aanum++] = "-f";
        aargs[aanum++] = NULL;          /* will hold the add data file */
        aargs[aanum++] = NULL;
@@ -584,6 +610,10 @@ main( int argc, char **argv )
        if ( chaserefs ) {
                bargs[banum++] = "-C";
        }
+       if ( ignore ) {
+               bargs[banum++] = "-i";
+               bargs[banum++] = ignore;
+       }
        bargs[banum++] = "-D";
        bargs[banum++] = NULL;
        bargs[banum++] = "-w";
@@ -649,6 +679,7 @@ main( int argc, char **argv )
                                bargs[banum - 1] = "-a";
                                bargs[banum] = battrs[jj];
                        }
+
                        fork_child( bcmd, bargs );
                        bargs[banum - 5] = "-D";
                }