]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/bconfig.c
fix typo (ITS#4784)
[openldap] / servers / slapd / bconfig.c
index 09e21cdff879cc6e0c9b06af8f8e84eb8ab52303..6efd2d2df6aeacb80cdbee6ba6c32f8ddfa3cd7f 100644 (file)
 
 #include "config.h"
 
-static struct berval config_rdn = BER_BVC("cn=config");
-static struct berval schema_rdn = BER_BVC("cn=schema");
+#define        CONFIG_RDN      "cn=config"
+#define        SCHEMA_RDN      "cn=schema"
+
+static struct berval config_rdn = BER_BVC(CONFIG_RDN);
+static struct berval schema_rdn = BER_BVC(SCHEMA_RDN);
 
 extern int slap_DN_strict;     /* dn.c */
 
@@ -71,6 +74,8 @@ typedef struct {
        int             cb_use_ldif;
 } CfBackInfo;
 
+static CfBackInfo cfBackInfo;
+
 static char    *passwd_salt;
 static char    *logfileName;
 #ifdef SLAP_AUTH_REWRITE
@@ -81,15 +86,25 @@ static struct berval cfdir;
 
 /* Private state */
 static AttributeDescription *cfAd_backend, *cfAd_database, *cfAd_overlay,
-       *cfAd_include;
+       *cfAd_include, *cfAd_attr, *cfAd_oc, *cfAd_om;
 
 static ConfigFile *cfn;
 
 static Avlnode *CfOcTree;
 
+/* System schema state */
+extern AttributeType *at_sys_tail;     /* at.c */
+extern ObjectClass *oc_sys_tail;       /* oc.c */
+extern OidMacro *om_sys_tail;  /* oidm.c */
+static AttributeType *cf_at_tail;
+static ObjectClass *cf_oc_tail;
+static OidMacro *cf_om_tail;
+
 static int config_add_internal( CfBackInfo *cfb, Entry *e, ConfigArgs *ca,
        SlapReply *rs, int *renumber, Operation *op );
 
+static int config_check_schema( CfBackInfo *cfb );
+
 static ConfigDriver config_fname;
 static ConfigDriver config_cfdir;
 static ConfigDriver config_generic;
@@ -162,6 +177,8 @@ enum {
        CFG_SSTR_IF_MIN,
        CFG_TTHREADS,
        CFG_MIRRORMODE,
+       CFG_HIDDEN,
+       CFG_MONITORING,
 
        CFG_LAST
 };
@@ -220,6 +237,7 @@ static OidRec OidMacros[] = {
  * OLcfgOv{Oc|At}:12           -> ppolicy
  * OLcfgOv{Oc|At}:13           -> constraint
  * OLcfgOv{Oc|At}:14           -> translucent
+ * OLcfgOv{Oc|At}:15           -> auditlog
  */
 
 /* alphabetical ordering */
@@ -256,7 +274,7 @@ static ConfigTable config_back_cf_table[] = {
                        "EQUALITY caseIgnoreMatch "
                        "SYNTAX OMsDirectoryString )", NULL, NULL },
        { "attribute",  "attribute", 2, 0, STRLENOF( "attribute" ),
-               ARG_PAREN|ARG_MAGIC|CFG_ATTR|ARG_NO_DELETE|ARG_NO_INSERT,
+               ARG_PAREN|ARG_MAGIC|CFG_ATTR,
                &config_generic, "( OLcfgGlAt:4 NAME 'olcAttributeTypes' "
                        "DESC 'OpenLDAP attributeTypes' "
                        "EQUALITY caseIgnoreMatch "
@@ -319,6 +337,9 @@ static ConfigTable config_back_cf_table[] = {
 #endif
                "( OLcfgGlAt:17 NAME 'olcGentleHUP' "
                        "SYNTAX OMsBoolean SINGLE-VALUE )", NULL, NULL },
+       { "hidden", "on|off", 2, 2, 0, ARG_DB|ARG_ON_OFF|ARG_MAGIC|CFG_HIDDEN,
+               &config_generic, "( OLcfgDbAt:0.17 NAME 'olcHidden' "
+                       "SYNTAX OMsBoolean SINGLE-VALUE )", NULL, NULL },
        { "idletimeout", "timeout", 2, 2, 0, ARG_INT,
                &global_idletimeout, "( OLcfgGlAt:18 NAME 'olcIdleTimeout' "
                        "SYNTAX OMsInteger SINGLE-VALUE )", NULL, NULL },
@@ -342,6 +363,7 @@ static ConfigTable config_back_cf_table[] = {
                        "SYNTAX OMsBoolean SINGLE-VALUE )", NULL, NULL },
        { "limits", "limits", 2, 0, 0, ARG_DB|ARG_MAGIC|CFG_LIMITS,
                &config_generic, "( OLcfgDbAt:0.5 NAME 'olcLimits' "
+                       "EQUALITY caseIgnoreMatch "
                        "SYNTAX OMsDirectoryString X-ORDERED 'VALUES' )", NULL, NULL },
        { "localSSF", "ssf", 2, 2, 0, ARG_INT,
                &local_ssf, "( OLcfgGlAt:26 NAME 'olcLocalSSF' "
@@ -351,6 +373,7 @@ static ConfigTable config_back_cf_table[] = {
                        "SYNTAX OMsDirectoryString SINGLE-VALUE )", NULL, NULL },
        { "loglevel", "level", 2, 0, 0, ARG_MAGIC,
                &config_loglevel, "( OLcfgGlAt:28 NAME 'olcLogLevel' "
+                       "EQUALITY caseIgnoreMatch "
                        "SYNTAX OMsDirectoryString )", NULL, NULL },
        { "maxDerefDepth", "depth", 2, 2, 0, ARG_DB|ARG_INT|ARG_MAGIC|CFG_DEPTH,
                &config_generic, "( OLcfgDbAt:0.6 NAME 'olcMaxDerefDepth' "
@@ -365,6 +388,7 @@ static ConfigTable config_back_cf_table[] = {
                ARG_IGNORED, NULL,
 #endif
                "( OLcfgGlAt:30 NAME 'olcModuleLoad' "
+                       "EQUALITY caseIgnoreMatch "
                        "SYNTAX OMsDirectoryString X-ORDERED 'VALUES' )", NULL, NULL },
        { "modulepath", "path", 2, 2, 0,
 #ifdef SLAPD_MODULES
@@ -374,14 +398,19 @@ static ConfigTable config_back_cf_table[] = {
 #endif
                "( OLcfgGlAt:31 NAME 'olcModulePath' "
                        "SYNTAX OMsDirectoryString SINGLE-VALUE )", NULL, NULL },
-       { "objectclass", "objectclass", 2, 0, 0, ARG_PAREN|ARG_MAGIC|CFG_OC|ARG_NO_DELETE|ARG_NO_INSERT,
+       { "monitoring", "TRUE|FALSE", 2, 2, 0,
+               ARG_MAGIC|CFG_MONITORING|ARG_DB|ARG_ON_OFF, &config_generic,
+               "( OLcfgDbAt:0.18 NAME 'olcMonitoring' "
+                       "SYNTAX OMsBoolean SINGLE-VALUE )", NULL, NULL },
+       { "objectclass", "objectclass", 2, 0, 0, ARG_PAREN|ARG_MAGIC|CFG_OC,
                &config_generic, "( OLcfgGlAt:32 NAME 'olcObjectClasses' "
                "DESC 'OpenLDAP object classes' "
                "EQUALITY caseIgnoreMatch "
                "SYNTAX OMsDirectoryString X-ORDERED 'VALUES' )",
                        NULL, NULL },
-       { "objectidentifier", NULL,     0, 0, 0, ARG_MAGIC|CFG_OID,
+       { "objectidentifier", "name> <oid",     3, 3, 0, ARG_MAGIC|CFG_OID,
                &config_generic, "( OLcfgGlAt:33 NAME 'olcObjectIdentifier' "
+                       "EQUALITY caseIgnoreMatch "
                        "SYNTAX OMsDirectoryString X-ORDERED 'VALUES' )", NULL, NULL },
        { "overlay", "overlay", 2, 2, 0, ARG_MAGIC,
                &config_overlay, "( OLcfgGlAt:34 NAME 'olcOverlay' "
@@ -391,6 +420,7 @@ static ConfigTable config_back_cf_table[] = {
                        "SYNTAX OMsDirectoryString SINGLE-VALUE )", NULL, NULL },
        { "password-hash", "hash", 2, 2, 0, ARG_MAGIC,
                &config_passwd_hash, "( OLcfgGlAt:36 NAME 'olcPasswordHash' "
+                       "EQUALITY caseIgnoreMatch "
                        "SYNTAX OMsDirectoryString )", NULL, NULL },
        { "pidfile", "file", 2, 2, 0, ARG_STRING,
                &slapd_pid_file, "( OLcfgGlAt:37 NAME 'olcPidFile' "
@@ -402,6 +432,7 @@ static ConfigTable config_back_cf_table[] = {
                ARG_IGNORED, NULL,
 #endif
                "( OLcfgGlAt:38 NAME 'olcPlugin' "
+                       "EQUALITY caseIgnoreMatch "
                        "SYNTAX OMsDirectoryString )", NULL, NULL },
        { "pluginlog", "filename", 2, 2, 0,
 #ifdef LDAP_SLAPI
@@ -419,6 +450,7 @@ static ConfigTable config_back_cf_table[] = {
                        "SUP labeledURI SINGLE-VALUE )", NULL, NULL },
        { "replica", "host or uri", 2, 0, 0, ARG_DB|ARG_MAGIC,
                &config_replica, "( OLcfgDbAt:0.7 NAME 'olcReplica' "
+                       "EQUALITY caseIgnoreMatch "
                        "SUP labeledURI X-ORDERED 'VALUES' )", NULL, NULL },
        { "replica-argsfile", NULL, 0, 0, 0, ARG_MAY_DB|ARG_MAGIC|ARG_STRING|CFG_REPLICA_ARGSFILE,
                &config_generic, "( OLcfgGlAt:43 NAME 'olcReplicaArgsFile' "
@@ -434,9 +466,11 @@ static ConfigTable config_back_cf_table[] = {
                        "SYNTAX OMsDirectoryString SINGLE-VALUE )", NULL, NULL },
        { "require", "features", 2, 0, 7, ARG_MAY_DB|ARG_MAGIC,
                &config_requires, "( OLcfgGlAt:47 NAME 'olcRequires' "
+                       "EQUALITY caseIgnoreMatch "
                        "SYNTAX OMsDirectoryString )", NULL, NULL },
        { "restrict", "op_list", 2, 0, 0, ARG_MAY_DB|ARG_MAGIC,
                &config_restrict, "( OLcfgGlAt:48 NAME 'olcRestrict' "
+                       "EQUALITY caseIgnoreMatch "
                        "SYNTAX OMsDirectoryString )", NULL, NULL },
        { "reverse-lookup", "on|off", 2, 2, 0,
 #ifdef SLAPD_RLOOKUPS
@@ -451,6 +485,7 @@ static ConfigTable config_back_cf_table[] = {
                        "SYNTAX OMsDN SINGLE-VALUE )", NULL, NULL },
        { "rootDSE", "file", 2, 2, 0, ARG_MAGIC|CFG_ROOTDSE,
                &config_generic, "( OLcfgGlAt:51 NAME 'olcRootDSE' "
+                       "EQUALITY caseIgnoreMatch "
                        "SYNTAX OMsDirectoryString )", NULL, NULL },
        { "rootpw", "password", 2, 2, 0, ARG_BERVAL|ARG_DB|ARG_MAGIC,
                &config_rootpw, "( OLcfgDbAt:0.9 NAME 'olcRootPW' "
@@ -490,6 +525,7 @@ static ConfigTable config_back_cf_table[] = {
                        "SYNTAX OMsDN SINGLE-VALUE )", NULL, NULL },
        { "security", "factors", 2, 0, 0, ARG_MAY_DB|ARG_MAGIC,
                &config_security, "( OLcfgGlAt:59 NAME 'olcSecurity' "
+                       "EQUALITY caseIgnoreMatch "
                        "SYNTAX OMsDirectoryString )", NULL, NULL },
        { "sizelimit", "limit", 2, 0, 0, ARG_MAY_DB|ARG_MAGIC,
                &config_sizelimit, "( OLcfgGlAt:60 NAME 'olcSizeLimit' "
@@ -510,9 +546,10 @@ static ConfigTable config_back_cf_table[] = {
                        "SYNTAX OMsDirectoryString SINGLE-VALUE )", NULL, NULL },
        { "subordinate", "[advertise]", 1, 2, 0, ARG_DB|ARG_MAGIC,
                &config_subordinate, "( OLcfgDbAt:0.15 NAME 'olcSubordinate' "
-                       "SYNTAX OMsDirectoryString )", NULL, NULL },
+                       "SYNTAX OMsDirectoryString SINGLE-VALUE )", NULL, NULL },
        { "suffix",     "suffix", 2, 2, 0, ARG_DB|ARG_DN|ARG_QUOTE|ARG_MAGIC,
                &config_suffix, "( OLcfgDbAt:0.10 NAME 'olcSuffix' "
+                       "EQUALITY distinguishedNameMatch "
                        "SYNTAX OMsDN )", NULL, NULL },
        { "syncrepl", NULL, 0, 0, 0, ARG_DB|ARG_MAGIC,
                &syncrepl_config, "( OLcfgDbAt:0.11 NAME 'olcSyncrepl' "
@@ -610,6 +647,7 @@ static ConfigTable config_back_cf_table[] = {
                        "SYNTAX OMsDN SINGLE-VALUE )", NULL, NULL },
        { "updateref", "url", 2, 2, 0, ARG_DB|ARG_MAGIC,
                &config_updateref, "( OLcfgDbAt:0.13 NAME 'olcUpdateRef' "
+                       "EQUALITY caseIgnoreMatch "
                        "SUP labeledURI )", NULL, NULL },
        { NULL, NULL, 0, 0, 0, ARG_IGNORED,
                NULL, NULL, NULL, NULL }
@@ -680,12 +718,14 @@ static ConfigOCs cf_ocs[] = {
                "DESC 'OpenLDAP Database-specific options' "
                "SUP olcConfig STRUCTURAL "
                "MUST olcDatabase "
-               "MAY ( olcSuffix $ olcSubordinate $ olcAccess $ olcLastMod $ olcLimits $ "
+               "MAY ( olcHidden $ olcSuffix $ olcSubordinate $ olcAccess $ "
+                "olcLastMod $ olcLimits $ "
                 "olcMaxDerefDepth $ olcPlugin $ olcReadOnly $ olcReplica $ "
                 "olcReplicaArgsFile $ olcReplicaPidFile $ olcReplicationInterval $ "
                 "olcReplogFile $ olcRequires $ olcRestrict $ olcRootDN $ olcRootPW $ "
                 "olcSchemaDN $ olcSecurity $ olcSizeLimit $ olcSyncrepl $ "
-                "olcTimeLimit $ olcUpdateDN $ olcUpdateRef $ olcMirrorMode ) )",
+                "olcTimeLimit $ olcUpdateDN $ olcUpdateRef $ olcMirrorMode $ "
+                "olcMonitoring ) )",
                        Cft_Database, NULL, cfAddDatabase },
        { "( OLcfgGlOc:5 "
                "NAME 'olcOverlayConfig' "
@@ -722,7 +762,6 @@ static ConfigOCs cf_ocs[] = {
 
 static int
 config_generic(ConfigArgs *c) {
-       char *p;
        int i;
 
        if ( c->op == SLAP_CONFIG_EMIT ) {
@@ -793,6 +832,13 @@ config_generic(ConfigArgs *c) {
                case CFG_DEPTH:
                        c->value_int = c->be->be_max_deref_depth;
                        break;
+               case CFG_HIDDEN:
+                       if ( SLAP_DBHIDDEN( c->be )) {
+                               c->value_int = 1;
+                       } else {
+                               rc = 1;
+                       }
+                       break;
                case CFG_OID: {
                        ConfigFile *cf = c->private;
                        if ( !cf )
@@ -915,6 +961,9 @@ config_generic(ConfigArgs *c) {
                        else
                                rc = 1;
                        break;
+               case CFG_MONITORING:
+                       c->value_int = (SLAP_DBMONITORING(c->be) != 0);
+                       break;
                case CFG_SSTR_IF_MAX:
                        c->value_int = index_substr_if_maxlen;
                        break;
@@ -1002,6 +1051,7 @@ config_generic(ConfigArgs *c) {
                case CFG_DEPTH:
                case CFG_LASTMOD:
                case CFG_MIRRORMODE:
+               case CFG_MONITORING:
                case CFG_SASLSECP:
                case CFG_SSTR_IF_MAX:
                case CFG_SSTR_IF_MIN:
@@ -1044,6 +1094,10 @@ config_generic(ConfigArgs *c) {
                        logfileName = NULL;
                        break;
 
+               case CFG_HIDDEN:
+                       c->be->be_flags &= ~SLAP_DBFLAG_HIDDEN;
+                       break;
+
                case CFG_ACL:
                        if ( c->valx < 0 ) {
                                AccessControl *end;
@@ -1068,6 +1122,76 @@ config_generic(ConfigArgs *c) {
                        }
                        break;
 
+               case CFG_OC: {
+                       CfEntryInfo *ce = c->ca_entry->e_private;
+                       /* can't modify the hardcoded schema */
+                       if ( ce->ce_parent->ce_type == Cft_Global )
+                               return 1;
+                       }
+                       cfn = c->private;
+                       if ( c->valx < 0 ) {
+                               ObjectClass *oc;
+
+                               for( oc = cfn->c_oc_head; oc; oc_next( &oc )) {
+                                       oc_delete( oc );
+                                       if ( oc  == cfn->c_oc_tail )
+                                               break;
+                               }
+                               cfn->c_oc_head = cfn->c_oc_tail = NULL;
+                       } else {
+                               ObjectClass *oc, *prev = NULL;
+                               int i;
+
+                               for ( i=0, oc=cfn->c_oc_head; i<c->valx; i++) {
+                                       prev = oc;
+                                       oc_next( &oc );
+                               }
+                               oc_delete( oc );
+                               if ( cfn->c_oc_tail == oc ) {
+                                       cfn->c_oc_tail = prev;
+                               }
+                               if ( cfn->c_oc_head == oc ) {
+                                       oc_next( &oc );
+                                       cfn->c_oc_head = oc;
+                               }
+                       }
+                       break;
+
+               case CFG_ATTR: {
+                       CfEntryInfo *ce = c->ca_entry->e_private;
+                       /* can't modify the hardcoded schema */
+                       if ( ce->ce_parent->ce_type == Cft_Global )
+                               return 1;
+                       }
+                       cfn = c->private;
+                       if ( c->valx < 0 ) {
+                               AttributeType *at;
+
+                               for( at = cfn->c_at_head; at; at_next( &at )) {
+                                       at_delete( at );
+                                       if ( at  == cfn->c_at_tail )
+                                               break;
+                               }
+                               cfn->c_at_head = cfn->c_at_tail = NULL;
+                       } else {
+                               AttributeType *at, *prev = NULL;
+                               int i;
+
+                               for ( i=0, at=cfn->c_at_head; i<c->valx; i++) {
+                                       prev = at;
+                                       at_next( &at );
+                               }
+                               at_delete( at );
+                               if ( cfn->c_at_tail == at ) {
+                                       cfn->c_at_tail = prev;
+                               }
+                               if ( cfn->c_at_head == at ) {
+                                       at_next( &at );
+                                       cfn->c_at_head = at;
+                               }
+                       }
+                       break;
+
                case CFG_LIMITS:
                        /* FIXME: there is no limits_free function */
                case CFG_ATOPT:
@@ -1076,9 +1200,7 @@ config_generic(ConfigArgs *c) {
                        /* FIXME: there is no way to remove attributes added by
                                a DSE file */
                case CFG_OID:
-               case CFG_OC:
                case CFG_DIT:
-               case CFG_ATTR:
                case CFG_MODPATH:
                default:
                        rc = 1;
@@ -1087,8 +1209,6 @@ config_generic(ConfigArgs *c) {
                return rc;
        }
 
-       p = strchr(c->line,'(' /*')'*/);
-
        switch(c->type) {
                case CFG_BACKEND:
                        if(!(c->bi = backend_info(c->argv[1]))) {
@@ -1203,7 +1323,9 @@ config_generic(ConfigArgs *c) {
                case CFG_OID: {
                        OidMacro *om;
 
-                       if(parse_oidm(c->fname, c->lineno, c->argc, c->argv, 1, &om))
+                       if ( c->op == LDAP_MOD_ADD && c->private && cfn != c->private )
+                               cfn = c->private;
+                       if(parse_oidm(c, 1, &om))
                                return(1);
                        if (!cfn->c_om_head) cfn->c_om_head = om;
                        cfn->c_om_tail = om;
@@ -1211,29 +1333,77 @@ config_generic(ConfigArgs *c) {
                        break;
 
                case CFG_OC: {
-                       ObjectClass *oc;
+                       ObjectClass *oc, *prev;
 
-                       if(parse_oc(c->fname, c->lineno, p, c->argv, &oc)) return(1);
+                       if ( c->op == LDAP_MOD_ADD && c->private && cfn != c->private )
+                               cfn = c->private;
+                       if ( c->valx < 0 ) {
+                               prev = cfn->c_oc_tail;
+                       } else {
+                               prev = NULL;
+                               /* If adding anything after the first, prev is easy */
+                               if ( c->valx ) {
+                                       int i;
+                                       for (i=0, oc = cfn->c_oc_head; i<c->valx; i++) {
+                                               prev = oc;
+                                               oc_next( &oc );
+                                       }
+                               } else
+                               /* If adding the first, and head exists, find its prev */
+                                       if (cfn->c_oc_head) {
+                                       for ( oc_start( &oc ); oc != cfn->c_oc_head; ) {
+                                               prev = oc;
+                                               oc_next( &oc );
+                                       }
+                               }
+                               /* else prev is NULL, append to end of global list */
+                       }
+                       if(parse_oc(c, &oc, prev)) return(1);
                        if (!cfn->c_oc_head) cfn->c_oc_head = oc;
-                       cfn->c_oc_tail = oc;
+                       if (cfn->c_oc_tail == prev) cfn->c_oc_tail = oc;
                        }
                        break;
 
-               case CFG_DIT: {
-                       ContentRule *cr;
+               case CFG_ATTR: {
+                       AttributeType *at, *prev;
 
-                       if(parse_cr(c->fname, c->lineno, p, c->argv, &cr)) return(1);
-                       if (!cfn->c_cr_head) cfn->c_cr_head = cr;
-                       cfn->c_cr_tail = cr;
+                       if ( c->op == LDAP_MOD_ADD && c->private && cfn != c->private )
+                               cfn = c->private;
+                       if ( c->valx < 0 ) {
+                               prev = cfn->c_at_tail;
+                       } else {
+                               prev = NULL;
+                               /* If adding anything after the first, prev is easy */
+                               if ( c->valx ) {
+                                       int i;
+                                       for (i=0, at = cfn->c_at_head; i<c->valx; i++) {
+                                               prev = at;
+                                               at_next( &at );
+                                       }
+                               } else
+                               /* If adding the first, and head exists, find its prev */
+                                       if (cfn->c_at_head) {
+                                       for ( at_start( &at ); at != cfn->c_at_head; ) {
+                                               prev = at;
+                                               at_next( &at );
+                                       }
+                               }
+                               /* else prev is NULL, append to end of global list */
+                       }
+                       if(parse_at(c, &at, prev)) return(1);
+                       if (!cfn->c_at_head) cfn->c_at_head = at;
+                       if (cfn->c_at_tail == prev) cfn->c_at_tail = at;
                        }
                        break;
 
-               case CFG_ATTR: {
-                       AttributeType *at;
+               case CFG_DIT: {
+                       ContentRule *cr;
 
-                       if(parse_at(c->fname, c->lineno, p, c->argv, &at)) return(1);
-                       if (!cfn->c_at_head) cfn->c_at_head = at;
-                       cfn->c_at_tail = at;
+                       if ( c->op == LDAP_MOD_ADD && c->private && cfn != c->private )
+                               cfn = c->private;
+                       if(parse_cr(c, &cr)) return(1);
+                       if (!cfn->c_cr_head) cfn->c_cr_head = cr;
+                       cfn->c_cr_tail = cr;
                        }
                        break;
 
@@ -1246,14 +1416,15 @@ config_generic(ConfigArgs *c) {
 
                case CFG_ACL:
                        /* Don't append to the global ACL if we're on a specific DB */
+                       i = c->valx;
                        if ( c->be != frontendDB && frontendDB->be_acl && c->valx == -1 ) {
                                AccessControl *a;
-                               c->valx = 0;
+                               i = 0;
                                for ( a=c->be->be_acl; a && a != frontendDB->be_acl;
                                        a = a->acl_next )
-                                       c->valx++;
+                                       i++;
                        }
-                       if ( parse_acl(c->be, c->fname, c->lineno, c->argc, c->argv, c->valx ) ) {
+                       if ( parse_acl(c->be, c->fname, c->lineno, c->argc, c->argv, i ) ) {
                                return 1;
                        }
                        break;
@@ -1347,6 +1518,8 @@ config_generic(ConfigArgs *c) {
                        {
                                struct berval bv;
                                ber_str2bv( c->argv[1], 0, 1, &bv );
+                               if ( c->op == LDAP_MOD_ADD && c->private && cfn != c->private )
+                                       cfn = c->private;
                                ber_bvarray_add( &cfn->c_dseFiles, &bv );
                        }
                        break;
@@ -1387,6 +1560,20 @@ config_generic(ConfigArgs *c) {
                                SLAP_DBFLAGS(c->be) |= SLAP_DBFLAG_SINGLE_SHADOW;
                        break;
 
+               case CFG_MONITORING:
+                       if(c->value_int)
+                               SLAP_DBFLAGS(c->be) |= SLAP_DBFLAG_MONITORING;
+                       else
+                               SLAP_DBFLAGS(c->be) &= ~SLAP_DBFLAG_MONITORING;
+                       break;
+
+               case CFG_HIDDEN:
+                       if (c->value_int)
+                               SLAP_DBFLAGS(c->be) |= SLAP_DBFLAG_HIDDEN;
+                       else
+                               SLAP_DBFLAGS(c->be) &= ~SLAP_DBFLAG_HIDDEN;
+                       break;
+
                case CFG_SSTR_IF_MAX:
                        if (c->value_int < index_substr_if_minlen) {
                                snprintf( c->msg, sizeof( c->msg ), "<%s> invalid value", c->argv[0] );
@@ -1439,6 +1626,10 @@ config_generic(ConfigArgs *c) {
                                ber_str2bv(ptr, 0, 1, &bv);
                                ber_bvarray_add( &modcur->mp_loads, &bv );
                        }
+                       /* Check for any new hardcoded schema */
+                       if ( c->op == LDAP_MOD_ADD && CONFIG_ONLINE_ADD( c )) {
+                               config_check_schema( &cfBackInfo );
+                       }
                        break;
 
                case CFG_MODPATH:
@@ -1894,7 +2085,10 @@ config_suffix(ConfigArgs *c)
 
        pdn = c->value_dn;
        ndn = c->value_ndn;
-       tbe = select_backend(&ndn, 0, 0);
+       if (SLAP_DBHIDDEN( c->be ))
+               tbe = NULL;
+       else
+               tbe = select_backend(&ndn, 0, 0);
        if(tbe == c->be) {
                Debug( LDAP_DEBUG_ANY, "%s: suffix already served by this backend!.\n",
                        c->log, 0, 0);
@@ -2000,7 +2194,7 @@ config_restrict(ConfigArgs *c) {
                { BER_BVC("compare"),           SLAP_RESTRICT_OP_COMPARE },
                { BER_BVC("read"),              SLAP_RESTRICT_OP_READS },
                { BER_BVC("write"),             SLAP_RESTRICT_OP_WRITES },
-               { BER_BVC("extended"),  SLAP_RESTRICT_OP_EXTENDED },
+               { BER_BVC("extended"),          SLAP_RESTRICT_OP_EXTENDED },
                { BER_BVC("extended=" LDAP_EXOP_START_TLS ),            SLAP_RESTRICT_EXOP_START_TLS },
                { BER_BVC("extended=" LDAP_EXOP_MODIFY_PASSWD ),        SLAP_RESTRICT_EXOP_MODIFY_PASSWD },
                { BER_BVC("extended=" LDAP_EXOP_X_WHO_AM_I ),           SLAP_RESTRICT_EXOP_WHOAMI },
@@ -2104,8 +2298,10 @@ config_disallows(ConfigArgs *c) {
 
 static int
 config_requires(ConfigArgs *c) {
-       slap_mask_t requires = 0;
-       int i;
+       slap_mask_t requires = frontendDB->be_requires;
+       int i, argc = c->argc;
+       char **argv = c->argv;
+
        slap_verbmasks requires_ops[] = {
                { BER_BVC("bind"),              SLAP_REQUIRE_BIND },
                { BER_BVC("LDAPv3"),            SLAP_REQUIRE_LDAP_V3 },
@@ -2125,11 +2321,23 @@ config_requires(ConfigArgs *c) {
                }
                return 0;
        }
-       i = verbs_to_mask(c->argc, c->argv, requires_ops, &requires);
+       /* "none" can only be first, to wipe out default/global values */
+       if ( strcasecmp( c->argv[ 1 ], "none" ) == 0 ) {
+               argv++;
+               argc--;
+               requires = 0;
+       }
+       i = verbs_to_mask(argc, argv, requires_ops, &requires);
        if ( i ) {
-               snprintf( c->msg, sizeof( c->msg ), "<%s> unknown feature", c->argv[0] );
-               Debug(LDAP_DEBUG_ANY, "%s: %s %s\n",
-                       c->log, c->msg, c->argv[i]);
+               if (strcasecmp( c->argv[ i ], "none" ) == 0 ) {
+                       snprintf( c->msg, sizeof( c->msg ), "<%s> \"none\" (#%d) must be listed first", c->argv[0], i - 1 );
+                       Debug(LDAP_DEBUG_ANY, "%s: %s\n",
+                               c->log, c->msg, 0);
+               } else {
+                       snprintf( c->msg, sizeof( c->msg ), "<%s> unknown feature #%d", c->argv[0], i - 1 );
+                       Debug(LDAP_DEBUG_ANY, "%s: %s \"%s\"\n",
+                               c->log, c->msg, c->argv[i]);
+               }
                return(1);
        }
        c->be->be_requires = requires;
@@ -2286,6 +2494,28 @@ loglevel2bvarray( int l, BerVarray *bva )
        return mask_to_verbs( loglevel_ops, l, bva );
 }
 
+int
+loglevel_print( FILE *out )
+{
+       int     i;
+
+       if ( loglevel_ops == NULL ) {
+               loglevel_init();
+       }
+
+       fprintf( out, "Installed log subsystems:\n\n" );
+       for ( i = 0; !BER_BVISNULL( &loglevel_ops[ i ].word ); i++ ) {
+               fprintf( out, "\t%-30s (%lu)\n",
+                       loglevel_ops[ i ].word.bv_val,
+                       loglevel_ops[ i ].mask );
+       }
+
+       fprintf( out, "\nNOTE: custom log subsystems may be later installed "
+               "by specific code\n\n" );
+
+       return 0;
+}
+
 static int config_syslog;
 
 static int
@@ -2426,7 +2656,7 @@ config_security(ConfigArgs *c) {
        }
        for(i = 1; i < c->argc; i++) {
                slap_ssf_t *tgt = NULL;
-               char *src;
+               char *src = NULL;
                for ( j=0; !BER_BVISNULL( &sec_keys[j].key ); j++ ) {
                        if(!strncasecmp(c->argv[i], sec_keys[j].key.bv_val,
                                sec_keys[j].key.bv_len)) {
@@ -2575,6 +2805,8 @@ config_replica(ConfigArgs *c) {
                        nr = add_replica_info(c->be, replicauri, replicahost);
                        break;
                } else if(!strncasecmp(c->argv[i], "uri=", STRLENOF("uri="))) {
+                       ber_len_t       len;
+
                        if ( replicauri ) {
                                snprintf( c->msg, sizeof( c->msg ), "<%s> replica host/URI already specified", c->argv[0] );
                                Debug(LDAP_DEBUG_ANY, "%s: %s \"%s\"\n", c->log, c->msg, replicauri );
@@ -2593,11 +2825,28 @@ config_replica(ConfigArgs *c) {
                                Debug(LDAP_DEBUG_ANY, "%s: %s\n", c->log, c->msg, 0 );
                                return(1);
                        }
+
+                       len = strlen(ludp->lud_scheme) + strlen(ludp->lud_host) +
+                               STRLENOF("://") + 1;
+                       if (ludp->lud_port != LDAP_PORT) {
+                               if (ludp->lud_port < 1 || ludp->lud_port > 65535) {
+                                       ldap_free_urldesc(ludp);
+                                       snprintf( c->msg, sizeof( c->msg ), "<%s> invalid port",
+                                               c->argv[0] );
+                                       Debug(LDAP_DEBUG_ANY, "%s: %s\n", c->log, c->msg, 0 );
+                                       return(1);
+                               }
+                               len += STRLENOF(":65535");
+                       }
+                       replicauri = ch_malloc( len );
+                       replicahost = lutil_strcopy( replicauri, ludp->lud_scheme );
+                       replicahost = lutil_strcopy( replicahost, "://" );
+                       if (ludp->lud_port == LDAP_PORT) {
+                               strcpy( replicahost, ludp->lud_host );
+                       } else {
+                               sprintf( replicahost, "%s:%d",ludp->lud_host,ludp->lud_port );
+                       }
                        ldap_free_urldesc(ludp);
-                       replicauri = c->argv[i] + STRLENOF("uri=");
-                       replicauri = ch_strdup( replicauri );
-                       replicahost = strchr( replicauri, '/' );
-                       replicahost += 2;
                        nr = add_replica_info(c->be, replicauri, replicahost);
                        break;
                }
@@ -2617,6 +2866,10 @@ config_replica(ConfigArgs *c) {
                                /* dealt with separately; don't let it get to bindconf */
                                ;
 
+                       } else if(!strncasecmp(c->argv[i], "host=", STRLENOF("host="))) {
+                               /* dealt with separately; don't let it get to bindconf */
+                               ;
+
                        } else if(!strncasecmp(c->argv[i], "suffix=", STRLENOF( "suffix="))) {
                                switch(add_replica_suffix(c->be, nr, c->argv[i] + STRLENOF("suffix="))) {
                                        case 1:
@@ -2930,6 +3183,10 @@ config_find_base( CfEntryInfo *root, struct berval *dn, CfEntryInfo **last )
 typedef struct setup_cookie {
        CfBackInfo *cfb;
        ConfigArgs *ca;
+       Entry *frontend;
+       Entry *config;
+       int     got_frontend;
+       int got_config;
 } setup_cookie;
 
 static int
@@ -2939,6 +3196,56 @@ config_ldif_resp( Operation *op, SlapReply *rs )
                setup_cookie *sc = op->o_callback->sc_private;
 
                sc->cfb->cb_got_ldif = 1;
+               /* Does the frontend exist? */
+               if ( !sc->got_frontend ) {
+                       if ( !strncmp( rs->sr_entry->e_nname.bv_val,
+                               "olcDatabase", STRLENOF( "olcDatabase" ))) {
+                               if ( strncmp( rs->sr_entry->e_nname.bv_val +
+                                       STRLENOF( "olcDatabase" ), "={-1}frontend",
+                                       STRLENOF( "={-1}frontend" ))) {
+                                       struct berval rdn;
+                                       int i = op->o_noop;
+                                       sc->ca->be = frontendDB;
+                                       sc->ca->bi = frontendDB->bd_info;
+                                       frontendDB->be_cf_ocs = &CFOC_FRONTEND;
+                                       rdn.bv_val = sc->ca->log;
+                                       rdn.bv_len = snprintf(rdn.bv_val, sizeof( sc->ca->log ),
+                                               "%s=" SLAP_X_ORDERED_FMT "%s",
+                                               cfAd_database->ad_cname.bv_val, -1,
+                                               sc->ca->bi->bi_type);
+                                       op->o_noop = 1;
+                                       sc->frontend = config_build_entry( op, rs,
+                                               sc->cfb->cb_root, sc->ca, &rdn, &CFOC_DATABASE,
+                                               sc->ca->be->be_cf_ocs );
+                                       op->o_noop = i;
+                               }
+                               sc->got_frontend++;
+                       }
+               }
+               /* Does the configDB exist? */
+               if ( sc->got_frontend && !sc->got_config &&
+                       !strncmp( rs->sr_entry->e_nname.bv_val,
+                       "olcDatabase", STRLENOF( "olcDatabase" ))) {
+                       if ( strncmp( rs->sr_entry->e_nname.bv_val +
+                               STRLENOF( "olcDatabase" ), "={0}config",
+                               STRLENOF( "={0}config" ))) {
+                               struct berval rdn;
+                               int i = op->o_noop;
+                               sc->ca->be = LDAP_STAILQ_FIRST( &backendDB );
+                               sc->ca->bi = sc->ca->be->bd_info;
+                               rdn.bv_val = sc->ca->log;
+                               rdn.bv_len = snprintf(rdn.bv_val, sizeof( sc->ca->log ),
+                                       "%s=" SLAP_X_ORDERED_FMT "%s",
+                                       cfAd_database->ad_cname.bv_val, 0,
+                                       sc->ca->bi->bi_type);
+                               op->o_noop = 1;
+                               sc->config = config_build_entry( op, rs, sc->cfb->cb_root,
+                                       sc->ca, &rdn, &CFOC_DATABASE, sc->ca->be->be_cf_ocs );
+                               op->o_noop = i;
+                       }
+                       sc->got_config++;
+               }
+
                rs->sr_err = config_add_internal( sc->cfb, rs->sr_entry, sc->ca, NULL, NULL, NULL );
                if ( rs->sr_err != LDAP_SUCCESS ) {
                        Debug( LDAP_DEBUG_ANY, "config error processing %s: %s\n",
@@ -3041,6 +3348,10 @@ config_setup_ldif( BackendDB *be, const char *dir, int readit ) {
                sc.cfb = cfb;
                sc.ca = &c;
                cb.sc_private = &sc;
+               sc.got_frontend = 0;
+               sc.got_config = 0;
+               sc.frontend = NULL;
+               sc.config = NULL;
 
                op->o_bd = &cfb->cb_db;
                
@@ -3053,6 +3364,15 @@ config_setup_ldif( BackendDB *be, const char *dir, int readit ) {
                /* Restore normal DN validation */
                slap_DN_strict = prev_DN_strict;
 
+               op->o_tag = LDAP_REQ_ADD;
+               if ( rc == LDAP_SUCCESS && sc.frontend ) {
+                       op->ora_e = sc.frontend;
+                       rc = op->o_bd->be_add( op, &rs );
+               }
+               if ( rc == LDAP_SUCCESS && sc.config ) {
+                       op->ora_e = sc.config;
+                       rc = op->o_bd->be_add( op, &rs );
+               }
                ldap_pvt_thread_pool_context_reset( thrctx );
        }
 
@@ -3106,6 +3426,7 @@ read_config(const char *fname, const char *dir) {
                return 1;
 
        cfb = be->be_private;
+       be->be_dfltaccess = ACL_NONE;
 
        /* If no .conf, or a dir was specified, setup the dir */
        if ( !fname || dir ) {
@@ -3298,7 +3619,7 @@ check_vals( ConfigTable *ct, ConfigArgs *ca, void *ptr, int isAttr )
        AttributeDescription *ad;
        BerVarray vals;
 
-       int i, rc = 0, sort = 0;
+       int i, rc = 0;
 
        if ( isAttr ) {
                a = ptr;
@@ -3311,7 +3632,6 @@ check_vals( ConfigTable *ct, ConfigArgs *ca, void *ptr, int isAttr )
        }
 
        if ( a && ( ad->ad_type->sat_flags & SLAP_AT_ORDERED_VAL )) {
-               sort = 1;
                rc = ordered_value_sort( a, 1 );
                if ( rc ) {
                        snprintf(ca->msg, sizeof( ca->msg ), "ordered_value_sort failed on attr %s\n",
@@ -3321,7 +3641,8 @@ check_vals( ConfigTable *ct, ConfigArgs *ca, void *ptr, int isAttr )
        }
        for ( i=0; vals[i].bv_val; i++ ) {
                ca->line = vals[i].bv_val;
-               if ( sort ) {
+               if (( ad->ad_type->sat_flags & SLAP_AT_ORDERED_VAL ) &&
+                       ca->line[0] == '{' ) {
                        char *idx = strchr( ca->line, '}' );
                        if ( idx ) ca->line = idx+1;
                }
@@ -3601,8 +3922,8 @@ config_add_internal( CfBackInfo *cfb, Entry *e, ConfigArgs *ca, SlapReply *rs,
                /* No parent, must be root. This will never happen... */
                if ( !last && !be_isroot( op ) && !be_shadow_update( op ))
                        return LDAP_NO_SUCH_OBJECT;
-               if ( !access_allowed( op, last->ce_entry, slap_schema.si_ad_children,
-                       NULL, ACL_WADD, NULL ))
+               if ( last && !access_allowed( op, last->ce_entry,
+                       slap_schema.si_ad_children, NULL, ACL_WADD, NULL ))
                        return LDAP_INSUFFICIENT_ACCESS;
        }
 
@@ -3712,7 +4033,7 @@ config_add_internal( CfBackInfo *cfb, Entry *e, ConfigArgs *ca, SlapReply *rs,
                                if ( ptr ) ca->line = ptr+1;
                        }
                        ca->valx = i;
-                       rc = config_parse_add( ct, ca );
+                       rc = config_parse_add( ct, ca, i );
                        if ( rc ) {
                                rc = LDAP_OTHER;
                                goto done;
@@ -3989,7 +4310,7 @@ config_modify_internal( CfEntryInfo *ce, Operation *op, SlapReply *rs,
        
        if(rc == LDAP_SUCCESS) {
                /* check that the entry still obeys the schema */
-               rc = entry_schema_check(op, e, NULL, 0,
+               rc = entry_schema_check(op, e, NULL, 0, 0,
                        &rs->sr_text, ca->msg, sizeof(ca->msg) );
        }
        if ( rc == LDAP_SUCCESS ) {
@@ -4051,8 +4372,9 @@ config_modify_internal( CfEntryInfo *ce, Operation *op, SlapReply *rs,
                                        if ( rc ) rc = LDAP_OTHER;
                                }
                                if ( ml->sml_values ) {
+                                       d = d->next;
                                        ch_free( dels );
-                                       dels = d->next;
+                                       dels = d;
                                }
                                if ( ml->sml_op == LDAP_MOD_REPLACE ) {
                                        ml->sml_values = vals;
@@ -4082,7 +4404,7 @@ config_modify_internal( CfEntryInfo *ce, Operation *op, SlapReply *rs,
                                                        ca->line = ptr+1;
                                                }
                                        }
-                                       rc = config_parse_add( ct, ca );
+                                       rc = config_parse_add( ct, ca, i );
                                        if ( rc ) {
                                                rc = LDAP_OTHER;
                                                goto out;
@@ -4324,7 +4646,7 @@ Entry *
 config_build_entry( Operation *op, SlapReply *rs, CfEntryInfo *parent,
        ConfigArgs *c, struct berval *rdn, ConfigOCs *main, ConfigOCs *extra )
 {
-       Entry *e = ch_calloc( 1, sizeof(Entry) );
+       Entry *e = entry_alloc();
        CfEntryInfo *ce = ch_calloc( 1, sizeof(CfEntryInfo) );
        struct berval val;
        struct berval ad_name;
@@ -4391,10 +4713,10 @@ config_build_entry( Operation *op, SlapReply *rs, CfEntryInfo *parent,
        }
 
        oc_at = attr_find( e->e_attrs, slap_schema.si_ad_objectClass );
-       rc = structural_class(oc_at->a_vals, &val, NULL, &text, c->msg,
-               sizeof(c->msg));
-       attr_merge_normalize_one(e, slap_schema.si_ad_structuralObjectClass, &val, NULL );
-       if ( op ) {
+       rc = structural_class(oc_at->a_vals, &oc, NULL, &text, c->msg,
+               sizeof(c->msg), op->o_tmpmemctx );
+       attr_merge_normalize_one(e, slap_schema.si_ad_structuralObjectClass, &oc->soc_cname, NULL );
+       if ( !op->o_noop ) {
                op->ora_e = e;
                op->o_bd->be_add( op, rs );
                if ( ( rs->sr_err != LDAP_SUCCESS ) 
@@ -4510,6 +4832,91 @@ config_build_modules( ConfigArgs *c, CfEntryInfo *ceparent,
 }
 #endif
 
+static int
+config_check_schema(CfBackInfo *cfb)
+{
+       struct berval schema_dn = BER_BVC(SCHEMA_RDN "," CONFIG_RDN);
+       ConfigArgs c = {0};
+       ConfigFile *cf = cfb->cb_config;
+       CfEntryInfo *ce, *last;
+       Entry *e;
+
+       /* If there's no root entry, we must be in the midst of converting */
+       if ( !cfb->cb_root )
+               return 0;
+
+       /* Make sure the main schema entry exists */
+       ce = config_find_base( cfb->cb_root, &schema_dn, &last );
+       if ( ce ) {
+               Attribute *a;
+               struct berval *bv;
+
+               e = ce->ce_entry;
+
+               /* Make sure it's up to date */
+               if ( cf_om_tail != om_sys_tail ) {
+                       a = attr_find( e->e_attrs, cfAd_om );
+                       if ( a ) {
+                               if ( a->a_nvals != a->a_vals )
+                                       ber_bvarray_free( a->a_nvals );
+                               ber_bvarray_free( a->a_vals );
+                               a->a_vals = NULL;
+                               a->a_nvals = NULL;
+                       }
+                       oidm_unparse( &bv, NULL, NULL, 1 );
+                       attr_merge_normalize( e, cfAd_om, bv, NULL );
+                       ber_bvarray_free( bv );
+                       cf_om_tail = om_sys_tail;
+               }
+               if ( cf_at_tail != at_sys_tail ) {
+                       a = attr_find( e->e_attrs, cfAd_attr );
+                       if ( a ) {
+                               if ( a->a_nvals != a->a_vals )
+                                       ber_bvarray_free( a->a_nvals );
+                               ber_bvarray_free( a->a_vals );
+                               a->a_vals = NULL;
+                               a->a_nvals = NULL;
+                       }
+                       at_unparse( &bv, NULL, NULL, 1 );
+                       attr_merge_normalize( e, cfAd_attr, bv, NULL );
+                       ber_bvarray_free( bv );
+                       cf_at_tail = at_sys_tail;
+               }
+               if ( cf_oc_tail != oc_sys_tail ) {
+                       a = attr_find( e->e_attrs, cfAd_oc );
+                       if ( a ) {
+                               if ( a->a_nvals != a->a_vals )
+                                       ber_bvarray_free( a->a_nvals );
+                               ber_bvarray_free( a->a_vals );
+                               a->a_vals = NULL;
+                               a->a_nvals = NULL;
+                       }
+                       oc_unparse( &bv, NULL, NULL, 1 );
+                       attr_merge_normalize( e, cfAd_oc, bv, NULL );
+                       ber_bvarray_free( bv );
+                       cf_oc_tail = oc_sys_tail;
+               }
+       } else {
+               SlapReply rs = {REP_RESULT};
+               c.private = NULL;
+               e = config_build_entry( NULL, &rs, cfb->cb_root, &c, &schema_rdn,
+                       &CFOC_SCHEMA, NULL );
+               if ( !e ) {
+                       return -1;
+               }
+               ce = e->e_private;
+               ce->ce_private = cfb->cb_config;
+               cf_at_tail = at_sys_tail;
+               cf_oc_tail = oc_sys_tail;
+               cf_om_tail = om_sys_tail;
+       }
+       return 0;
+}
+
+static const char *defacl[] = {
+       NULL, "to", "*", "by", "*", "none", NULL
+};
+
 static int
 config_back_db_open( BackendDB *be )
 {
@@ -4528,22 +4935,31 @@ config_back_db_open( BackendDB *be )
        void *thrctx = NULL;
 
        Debug( LDAP_DEBUG_TRACE, "config_back_db_open\n", 0, 0, 0);
-       /* If we read the config from back-ldif, nothing to do here */
-       if ( cfb->cb_got_ldif )
-               return 0;
 
-       if ( cfb->cb_use_ldif ) {
-               thrctx = ldap_pvt_thread_pool_context();
-               op = (Operation *) &opbuf;
-               connection_fake_init( &conn, op, thrctx );
+       /* If we have no explicitly configured ACLs, don't just use
+        * the global ACLs. Explicitly deny access to everything.
+        */
+       if ( frontendDB->be_acl && be->be_acl == frontendDB->be_acl ) {
+               parse_acl(be, "config_back_db_open", 0, 6, (char **)defacl, 0 );
+       }
 
-               op->o_tag = LDAP_REQ_ADD;
-               op->o_callback = &cb;
-               op->o_bd = &cfb->cb_db;
-               op->o_dn = op->o_bd->be_rootdn;
-               op->o_ndn = op->o_bd->be_rootndn;
-       } else {
-               op = NULL;
+       /* If we read the config from back-ldif, do some quick sanity checks */
+       if ( cfb->cb_got_ldif ) {
+               return config_check_schema( cfb );
+       }
+
+       thrctx = ldap_pvt_thread_pool_context();
+       op = (Operation *) &opbuf;
+       connection_fake_init( &conn, op, thrctx );
+
+       op->o_tag = LDAP_REQ_ADD;
+       op->o_callback = &cb;
+       op->o_bd = &cfb->cb_db;
+       op->o_dn = op->o_bd->be_rootdn;
+       op->o_ndn = op->o_bd->be_rootndn;
+
+       if ( !cfb->cb_use_ldif ) {
+               op->o_noop = 1;
        }
 
        /* create root of tree */
@@ -4589,6 +5005,10 @@ config_back_db_open( BackendDB *be )
                return -1;
        }
        ce = e->e_private;
+       ce->ce_private = cfb->cb_config;
+       cf_at_tail = at_sys_tail;
+       cf_oc_tail = oc_sys_tail;
+       cf_om_tail = om_sys_tail;
 
        /* Create schema nodes for included schema... */
        if ( cfb->cb_config->c_kids ) {
@@ -4779,8 +5199,6 @@ config_back_db_destroy( BackendDB *be )
                backend_destroy_one( &cfb->cb_db, 0 );
        }
 
-       free( be->be_private );
-
        loglevel_destroy();
 
        return 0;
@@ -4792,7 +5210,7 @@ config_back_db_init( BackendDB *be )
        struct berval dn;
        CfBackInfo *cfb;
 
-       cfb = ch_calloc( 1, sizeof(CfBackInfo));
+       cfb = &cfBackInfo;
        cfb->cb_config = ch_calloc( 1, sizeof(ConfigFile));
        cfn = cfb->cb_config;
        be->be_private = cfb;
@@ -4896,9 +5314,12 @@ static struct {
        char *name;
        AttributeDescription **desc;
 } ads[] = {
+       { "attribute", &cfAd_attr },
        { "backend", &cfAd_backend },
        { "database", &cfAd_database },
        { "include", &cfAd_include },
+       { "objectclass", &cfAd_oc },
+       { "objectidentifier", &cfAd_om },
        { "overlay", &cfAd_overlay },
        { NULL, NULL }
 };
@@ -4930,6 +5351,7 @@ int
 config_back_initialize( BackendInfo *bi )
 {
        ConfigTable             *ct = config_back_cf_table;
+       ConfigArgs ca;
        char                    *argv[4];
        int                     i;
        AttributeDescription    *ad = NULL;
@@ -4981,11 +5403,17 @@ config_back_initialize( BackendInfo *bi )
        bi->bi_tool_entry_get = config_tool_entry_get;
        bi->bi_tool_entry_put = config_tool_entry_put;
 
+       ca.argv = argv;
+       argv[ 0 ] = "slapd";
+       ca.argv = argv;
+       ca.argc = 3;
+       ca.fname = argv[0];
+
        argv[3] = NULL;
        for (i=0; OidMacros[i].name; i++ ) {
                argv[1] = OidMacros[i].name;
                argv[2] = OidMacros[i].oid;
-               parse_oidm( "slapd", i, 3, argv, 0, NULL );
+               parse_oidm( &ca, 0, NULL );
        }
 
        bi->bi_cf_ocs = cf_ocs;