]> git.sur5r.net Git - openldap/commitdiff
Add -s option to slapadd to disable schema checking
authorLuke Howard <lukeh@openldap.org>
Sun, 8 Jan 2006 20:18:14 +0000 (20:18 +0000)
committerLuke Howard <lukeh@openldap.org>
Sun, 8 Jan 2006 20:18:14 +0000 (20:18 +0000)
servers/slapd/slap.h
servers/slapd/slapadd.c
servers/slapd/slapcommon.c

index 2b310fcd176d76e60f82339d0c7c44b273c69b65..d1187445e35c1504de8867d970d6f612537decb5 100644 (file)
@@ -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
index 588fa2a282c6e1078f4bac4d6853c6a1a07ae95c..11cf55f371a93a12a7b458070c4d9120079a2421 100644 (file)
@@ -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;
+                               }
                        }
                }
 
index acebb9a3f82e9a2e9ed7f9004d200cbb36644bf1..a1d8c0d9d819d92a9324a15dd299b9a0287eabc6 100644 (file)
@@ -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 */