X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fslapadd.c;h=4e93a55f2239db94325b1188561f8a1d2875a1fd;hb=4f05d992f2146921dbc13d3477de9918f20172b9;hp=58041d3026fea10c2b7d4665a42263a12a174253;hpb=1c1b5ca0c4cc7da98beff036c0ab54042fe63899;p=openldap diff --git a/servers/slapd/slapadd.c b/servers/slapd/slapadd.c index 58041d3026..4e93a55f22 100644 --- a/servers/slapd/slapadd.c +++ b/servers/slapd/slapadd.c @@ -1,7 +1,7 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software . * - * Copyright 1998-2012 The OpenLDAP Foundation. + * Copyright 1998-2014 The OpenLDAP Foundation. * Portions Copyright 1998-2003 Kurt D. Zeilenga. * Portions Copyright 2003 IBM Corporation. * All rights reserved. @@ -40,18 +40,20 @@ #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,19 +98,27 @@ 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, - ftell( ldiffp->fp ), + ftello( ldiffp->fp ), 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 ) { @@ -473,7 +483,7 @@ slapadd( int argc, char **argv ) bvtext.bv_val[0] = '\0'; if ( enable_meter ) { - lutil_meter_update( &meter, ftell( ldiffp->fp ), 1); + lutil_meter_update( &meter, ftello( ldiffp->fp ), 1); lutil_meter_close( &meter ); }