]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/slapadd.c
ITS#7750 fix olcDbConfig modification
[openldap] / servers / slapd / slapadd.c
index 58041d3026fea10c2b7d4665a42263a12a174253..951739406248f2884b4b7185415baf63987c5fb0 100644 (file)
@@ -1,7 +1,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2012 The OpenLDAP Foundation.
+ * Copyright 1998-2013 The OpenLDAP Foundation.
  * Portions Copyright 1998-2003 Kurt D. Zeilenga.
  * Portions Copyright 2003 IBM Corporation.
  * All rights reserved.
 
 #include "slapcommon.h"
 
+extern int slap_DN_strict;     /* dn.c */
+
 static char csnbuf[ LDAP_PVT_CSNSTR_BUFSIZE ];
 
 typedef struct Erec {
        Entry *e;
-       int lineno;
-       int nextline;
+       unsigned long lineno;
+       unsigned long nextline;
 } Erec;
 
 typedef struct Trec {
        Entry *e;
-       int lineno;
-       int nextline;
+       unsigned long lineno;
+       unsigned long nextline;
        int rc;
        int ready;
 } Trec;
@@ -96,11 +98,19 @@ again:
        {
                BackendDB *bd;
                Entry *e;
+               int prev_DN_strict;
 
                if ( erec->lineno < jumpline )
                        goto again;
 
+               if ( !dbnum ) {
+                       prev_DN_strict = slap_DN_strict;
+                       slap_DN_strict = 0;
+               }
                e = str2entry2( buf, checkvals );
+               if ( !dbnum ) {
+                       slap_DN_strict = prev_DN_strict;
+               }
 
                if ( enable_meter )
                        lutil_meter_update( &meter,
@@ -108,7 +118,7 @@ again:
                                         0);
 
                if( e == NULL ) {
-                       fprintf( stderr, "%s: could not parse entry (line=%d)\n",
+                       fprintf( stderr, "%s: could not parse entry (line=%lu)\n",
                                progname, erec->lineno );
                        return -2;
                }
@@ -117,7 +127,7 @@ again:
                if( BER_BVISEMPTY( &e->e_nname ) &&
                        !BER_BVISEMPTY( be->be_nsuffix ))
                {
-                       fprintf( stderr, "%s: line %d: "
+                       fprintf( stderr, "%s: line %lu: "
                                "cannot add entry with empty dn=\"%s\"",
                                progname, erec->lineno, e->e_dn );
                        bd = select_backend( &e->e_nname, nosubordinates );
@@ -144,7 +154,7 @@ again:
                /* check backend */
                bd = select_backend( &e->e_nname, nosubordinates );
                if ( bd != be ) {
-                       fprintf( stderr, "%s: line %d: "
+                       fprintf( stderr, "%s: line %lu: "
                                "database #%d (%s) not configured to hold \"%s\"",
                                progname, erec->lineno,
                                dbnum,
@@ -432,7 +442,7 @@ slapadd( int argc, char **argv )
                        id = be->be_entry_put( be, erec.e, &bvtext );
                        if( id == NOID ) {
                                fprintf( stderr, "%s: could not add entry dn=\"%s\" "
-                                                                "(line=%d): %s\n", progname, erec.e->e_dn,
+                                                                "(line=%lu): %s\n", progname, erec.e->e_dn,
                                                                 erec.lineno, bvtext.bv_val );
                                rc = EXIT_FAILURE;
                                if( continuemode ) {