From: Luke Howard Date: Sun, 8 Jan 2006 20:18:14 +0000 (+0000) Subject: Add -s option to slapadd to disable schema checking X-Git-Tag: OPENLDAP_REL_ENG_2_4_BP~400 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=c51a71e5c2b01f591d187fd0733463037e248b80;p=openldap Add -s option to slapadd to disable schema checking --- diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index 2b310fcd17..d1187445e3 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -1514,6 +1514,7 @@ LDAP_SLAPD_V (int) slapMode; #define SLAP_TOOL_READMAIN 0x0200 #define SLAP_TOOL_READONLY 0x0400 #define SLAP_TOOL_QUICK 0x0800 +#define SLAP_TOOL_NO_SCHEMA_CHECK 0x1000 #define SB_TLS_DEFAULT (-1) #define SB_TLS_OFF 0 diff --git a/servers/slapd/slapadd.c b/servers/slapd/slapadd.c index 588fa2a282..11cf55f371 100644 --- a/servers/slapd/slapadd.c +++ b/servers/slapd/slapadd.c @@ -193,16 +193,18 @@ slapadd( int argc, char **argv ) /* check schema */ op->o_bd = be; - rc = entry_schema_check( op, e, NULL, manage, - &text, textbuf, textlen ); + if ( (slapMode & SLAP_TOOL_NO_SCHEMA_CHECK) == 0) { + rc = entry_schema_check( op, e, NULL, manage, + &text, textbuf, textlen ); - if( rc != LDAP_SUCCESS ) { - fprintf( stderr, "%s: dn=\"%s\" (line=%d): (%d) %s\n", - progname, e->e_dn, lineno, rc, text ); - rc = EXIT_FAILURE; - entry_free( e ); - if( continuemode ) continue; - break; + if( rc != LDAP_SUCCESS ) { + fprintf( stderr, "%s: dn=\"%s\" (line=%d): (%d) %s\n", + progname, e->e_dn, lineno, rc, text ); + rc = EXIT_FAILURE; + entry_free( e ); + if( continuemode ) continue; + break; + } } } diff --git a/servers/slapd/slapcommon.c b/servers/slapd/slapcommon.c index acebb9a3f8..a1d8c0d9d8 100644 --- a/servers/slapd/slapcommon.c +++ b/servers/slapd/slapcommon.c @@ -63,7 +63,7 @@ usage( int tool, const char *progname ) case SLAPADD: options = " [-c]\n\t[-g] [-n databasenumber | -b suffix]\n" - "\t[-l ldiffile] [-q] [-u] [-w]\n"; + "\t[-l ldiffile] [-q] [-u] [-s] [-w]\n"; break; case SLAPAUTH: @@ -211,7 +211,7 @@ slap_tool_init( switch( tool ) { case SLAPADD: - options = "b:cd:f:F:gl:n:qtuvw"; + options = "b:cd:f:F:gl:n:qstuvw"; break; case SLAPCAT: @@ -344,7 +344,10 @@ slap_tool_init( break; case 's': /* dump subtree */ - subtree = strdup( optarg ); + if ( tool == SLAPADD ) + mode |= SLAP_TOOL_NO_SCHEMA_CHECK; + else if ( tool == SLAPCAT ) + subtree = strdup( optarg ); break; case 't': /* turn on truncate */