#define CFOC_OVERLAY cf_ocs[5]
#define CFOC_INCLUDE cf_ocs[6]
#define CFOC_MODULE cf_ocs[7]
+#define CFOC_FRONTEND cf_ocs[8]
static ConfigOCs cf_ocs[] = {
{ "( OLcfgGlOc:1 "
"olcPluginLogFile $ olcReadOnly $ olcReferral $ "
"olcReplicaPidFile $ olcReplicaArgsFile $ olcReplicationInterval $ "
"olcReplogFile $ olcRequires $ olcRestrict $ olcReverseLookup $ "
- "olcRootDSE $ olcRootPW $ "
+ "olcRootDSE $ "
"olcSaslHost $ olcSaslRealm $ olcSaslSecProps $ "
"olcSecurity $ olcSizeLimit $ "
"olcSockbufMaxIncoming $ olcSockbufMaxIncomingAuth $ olcSrvtab $ "
"MAY ( cn $ olcModulePath $ olcModuleLoad ) )",
Cft_Module, NULL, cfAddModule },
#endif
+ /* This should be STRUCTURAL like all the other database classes, but
+ * that would mean inheriting all of the olcDatabaseConfig attributes,
+ * which causes them to be merged twice in config_build_entry.
+ */
+ { "( OLcfgGlOc:9 "
+ "NAME 'olcFrontendConfig' "
+ "DESC 'OpenLDAP frontend configuration' "
+ "AUXILIARY "
+ "MAY olcDefaultSearchBase )",
+ Cft_Database, NULL, NULL },
{ NULL, 0, NULL }
};
static int
config_rootpw(ConfigArgs *c) {
Backend *tbe;
- /* config_add_internal sets c->be = frontendDB. While the cn=config
- * rootpw is technically inside a backend, we expose it in the
- * global entry, and need to point to it properly here.
- */
- if (c->be == frontendDB)
- c->be = LDAP_STAILQ_FIRST(&backendDB);
if (c->op == SLAP_CONFIG_EMIT) {
if (!BER_BVISEMPTY(&c->be->be_rootpw)) {
return LDAP_NAMING_VIOLATION;
gotindex = 1;
index = atoi(ptr1+1);
- if ( index < 0 )
- return LDAP_NAMING_VIOLATION;
+ if ( index < 0 ) {
+ /* Special case, we allow -1 for the frontendDB */
+ if ( index != -1 || ce_type != Cft_Database ||
+ strncmp( ptr2+1, "frontend,", STRLENOF("frontend,") ))
+
+ return LDAP_NAMING_VIOLATION;
+ }
}
/* count related kids */
leave:
if ( rc ) {
if ( (colst[0]->co_type == Cft_Database) && ca->be ) {
- backend_destroy_one( ca->be, 1 );
+ if ( ca->be != frontendDB )
+ backend_destroy_one( ca->be, 1 );
} else if ( (colst[0]->co_type == Cft_Overlay) && ca->bi ) {
overlay_destroy_one( ca->be, (slap_overinst *)ca->bi );
}
CfEntryInfo *ce, *ceparent;
int i;
BackendInfo *bi;
- BackendDB *bptr;
ConfigArgs c;
Connection conn = {0};
char opbuf[OPERATION_BUFFER_SIZE];
}
/* Create database nodes... */
- i = -1;
- LDAP_STAILQ_FOREACH( be, &backendDB, be_next ) {
+ frontendDB->be_cf_ocs = &CFOC_FRONTEND;
+ LDAP_STAILQ_NEXT(frontendDB, be_next) = LDAP_STAILQ_FIRST(&backendDB);
+ for ( i = -1, be = frontendDB ; be;
+ i++, be = LDAP_STAILQ_NEXT( be, be_next )) {
slap_overinfo *oi = NULL;
- i++;
- if ( i == 0 ) {
- bptr = frontendDB;
- } else {
- bptr = be;
- }
- if ( overlay_is_over( bptr )) {
- oi = bptr->bd_info->bi_private;
+
+ if ( overlay_is_over( be )) {
+ oi = be->bd_info->bi_private;
bi = oi->oi_orig;
} else {
- bi = bptr->bd_info;
+ bi = be->bd_info;
}
rdn.bv_val = c.log;
rdn.bv_len = sprintf(rdn.bv_val, "%s=" IFMT "%s", cfAd_database->ad_cname.bv_val,
i, bi->bi_type);
- c.be = bptr;
+ c.be = be;
c.bi = bi;
e = config_build_entry( op, &rs, ceparent, &c, &rdn, &CFOC_DATABASE,
be->be_cf_ocs );
rdn.bv_val = c.log;
rdn.bv_len = sprintf(rdn.bv_val, "%s=" IFMT "%s",
cfAd_overlay->ad_cname.bv_val, j, on->on_bi.bi_type );
- c.be = bptr;
+ c.be = be;
c.bi = &on->on_bi;
oe = config_build_entry( op, &rs, ce, &c, &rdn,
&CFOC_OVERLAY, c.bi->bi_cf_ocs );