Commit 048a36a6 authored by Howard Chu's avatar Howard Chu
Browse files

Fix prev commit, trim unused cfOC vars

parent bd635078
......@@ -30,14 +30,11 @@
# define SLAP_BDB_ALLOW_DIRTY_READ
#endif
#define bdb_cf_oc BDB_SYMBOL(cf_oc)
#define bdb_cf_gen BDB_SYMBOL(cf_gen)
#define bdb_cf_cleanup BDB_SYMBOL(cf_cleanup)
#define bdb_checkpoint BDB_SYMBOL(checkpoint)
#define bdb_online_index BDB_SYMBOL(online_index)
static ObjectClass *bdb_oc;
static ConfigDriver bdb_cf_gen;
enum {
......@@ -130,20 +127,10 @@ static ConfigOCs bdbocs[] = {
"olcDbNoSync $ olcDbDirtyRead $ olcDbIDLcacheSize $ "
"olcDbIndex $ olcDbLinearIndex $ olcDbLockDetect $ "
"olcDbMode $ olcDbSearchStack $ olcDbShmKey ) )",
Cft_Database, &bdb_oc, bdbcfg },
Cft_Database, bdbcfg },
{ NULL, 0, NULL }
};
static int
bdb_cf_oc(ConfigArgs *c)
{
if ( c->op == SLAP_CONFIG_EMIT ) {
value_add_one( &c->rvalue_vals, &bdb_oc->soc_cname );
return 0;
}
return 1;
}
static slap_verbmasks bdb_lockd[] = {
{ BER_BVC("default"), DB_LOCK_DEFAULT },
{ BER_BVC("oldest"), DB_LOCK_OLDEST },
......
......@@ -61,8 +61,6 @@ struct ldif_info {
#define ENTRY_BUFF_INCREMENT 500
static ObjectClass *ldif_oc;
static ConfigTable ldifcfg[] = {
{ "directory", "dir", 2, 2, 0, ARG_BERVAL|ARG_OFFSET,
(void *)offsetof(struct ldif_info, li_base_path),
......@@ -79,8 +77,7 @@ static ConfigOCs ldifocs[] = {
"NAME 'olcLdifConfig' "
"DESC 'LDIF backend configuration' "
"SUP olcDatabaseConfig "
"MUST ( olcDbDirectory ) )", Cft_Database,
&ldif_oc, ldifcfg },
"MUST ( olcDbDirectory ) )", Cft_Database, ldifcfg },
{ NULL, 0, NULL }
};
......
......@@ -25,6 +25,7 @@
#define SLAPD_TOOLS
#include "slap.h"
#include "config.h"
static slap_overinst *overlays;
......@@ -71,6 +72,8 @@ over_db_config(
slap_overinfo *oi = be->bd_info->bi_private;
slap_overinst *on = oi->oi_list;
BackendInfo *bi_orig = be->bd_info;
ConfigArgs ca;
ConfigTable *ct;
int rc = 0;
if ( oi->oi_orig->bi_db_config ) {
......@@ -123,8 +126,22 @@ over_db_config(
if ( rc != SLAP_CONF_UNKNOWN ) return rc;
}
ca.argv = argv;
ca.argc = argc;
ca.fname = fname;
ca.lineno = lineno;
ca.be = be;
for (; on; on=on->on_next) {
if (on->on_bi.bi_db_config) {
rc = SLAP_CONF_UNKNOWN;
if (on->on_bi.bi_cf_ocs) {
ConfigTable *ct;
ca.bi = &on->on_bi;
ct = config_find_keyword( on->on_bi.bi_cf_ocs->co_table, &ca );
if ( ct ) {
rc = config_add_vals( ct, &ca );
}
}
if (on->on_bi.bi_db_config && rc == SLAP_CONF_UNKNOWN) {
be->bd_info = &on->on_bi;
rc = on->on_bi.bi_db_config( be, fname, lineno,
argc, argv );
......
......@@ -86,9 +86,6 @@ static struct berval cfdir;
static AttributeDescription *cfAd_backend, *cfAd_database, *cfAd_overlay,
*cfAd_include;
static ObjectClass *cfOc_schema, *cfOc_global, *cfOc_backend, *cfOc_database,
*cfOc_include, *cfOc_overlay, *cfOc_module;
static ConfigFile cf_prv, *cfn = &cf_prv;
static Avlnode *CfOcTree;
......@@ -614,19 +611,19 @@ static ConfigOCs cf_ocs[] = {
"olcTLSCertificateKeyFile $ olcTLSCipherSuite $ olcTLSCRLCheck $ "
"olcTLSRandFile $ olcTLSVerifyClient $ "
"olcObjectIdentifier $ olcAttributeTypes $ olcObjectClasses $ "
"olcDitContentRules ) )", Cft_Global, &cfOc_global },
"olcDitContentRules ) )", Cft_Global },
{ "( OLcfgGlOc:3 "
"NAME 'olcSchemaConfig' "
"DESC 'OpenLDAP schema object' "
"SUP olcConfig STRUCTURAL "
"MAY ( cn $ olcObjectIdentifier $ olcAttributeTypes $ "
"olcObjectClasses $ olcDitContentRules ) )",
Cft_Schema, &cfOc_schema, NULL, cfAddSchema },
Cft_Schema, NULL, cfAddSchema },
{ "( OLcfgGlOc:4 "
"NAME 'olcBackendConfig' "
"DESC 'OpenLDAP Backend-specific options' "
"SUP olcConfig STRUCTURAL "
"MUST olcBackend )", Cft_Backend, &cfOc_backend, NULL, cfAddBackend },
"MUST olcBackend )", Cft_Backend, NULL, cfAddBackend },
{ "( OLcfgGlOc:5 "
"NAME 'olcDatabaseConfig' "
"DESC 'OpenLDAP Database-specific options' "
......@@ -637,26 +634,26 @@ static ConfigOCs cf_ocs[] = {
"olcReplogFile $ olcRequires $ olcRestrict $ olcRootDN $ olcRootPW $ "
"olcSchemaDN $ olcSecurity $ olcSizeLimit $ olcSyncrepl $ "
"olcTimeLimit $ olcUpdateDN $ olcUpdateRef ) )",
Cft_Database, &cfOc_database, NULL, cfAddDatabase },
Cft_Database, NULL, cfAddDatabase },
{ "( OLcfgGlOc:6 "
"NAME 'olcOverlayConfig' "
"DESC 'OpenLDAP Overlay-specific options' "
"SUP olcConfig STRUCTURAL "
"MUST olcOverlay )", Cft_Overlay, &cfOc_overlay, NULL, cfAddOverlay },
"MUST olcOverlay )", Cft_Overlay, NULL, cfAddOverlay },
{ "( OLcfgGlOc:7 "
"NAME 'olcIncludeFile' "
"DESC 'OpenLDAP configuration include file' "
"SUP olcConfig STRUCTURAL "
"MUST olcInclude "
"MAY ( cn $ olcRootDSE ) )",
Cft_Include, &cfOc_include, NULL, cfAddInclude },
Cft_Include, NULL, cfAddInclude },
#ifdef SLAPD_MODULES
{ "( OLcfgGlOc:8 "
"NAME 'olcModuleList' "
"DESC 'OpenLDAP dynamic module info' "
"SUP olcConfig STRUCTURAL "
"MUST ( olcModulePath $ olcModuleLoad ) "
"MAY cn )", Cft_Module, &cfOc_module, NULL, cfAddModule },
"MAY cn )", Cft_Module, NULL, cfAddModule },
#endif
{ NULL, 0, NULL }
};
......@@ -2513,7 +2510,7 @@ config_register_schema(ConfigTable *ct, ConfigOCs *ocs) {
for (i=0; ocs[i].co_def; i++) {
if ( ocs[i].co_oc ) {
ocs[i].co_name = &((*ocs[i].co_oc)->soc_cname);
ocs[i].co_name = &ocs[i].co_oc->soc_cname;
if ( !ocs[i].co_table )
ocs[i].co_table = ct;
avl_insert( &CfOcTree, &ocs[i], CfOc_cmp, avl_dup_error );
......@@ -2659,8 +2656,8 @@ sort_attrs( Entry *e, ConfigOCs **colst, int nocs )
int i, j;
for (i=0; i<nocs; i++) {
if ( (*colst[i]->co_oc)->soc_required ) {
AttributeType **at = (*colst[i]->co_oc)->soc_required;
if ( colst[i]->co_oc->soc_required ) {
AttributeType **at = colst[i]->co_oc->soc_required;
for (j=0; at[j]; j++) {
for (a=e->e_attrs, prev=&e->e_attrs; a;
prev = &(*prev)->a_next, a=a->a_next) {
......@@ -2678,8 +2675,8 @@ sort_attrs( Entry *e, ConfigOCs **colst, int nocs )
}
}
}
if ( (*colst[i]->co_oc)->soc_allowed ) {
AttributeType **at = (*colst[i]->co_oc)->soc_allowed;
if ( colst[i]->co_oc->soc_allowed ) {
AttributeType **at = colst[i]->co_oc->soc_allowed;
for (j=0; at[j]; j++) {
for (a=e->e_attrs, prev=&e->e_attrs; a;
prev = &(*prev)->a_next, a=a->a_next) {
......@@ -3654,7 +3651,7 @@ config_build_entry( Operation *op, SlapReply *rs, CfEntryInfo *parent,
val.bv_len = rdn->bv_len - (val.bv_val - rdn->bv_val);
attr_merge_normalize_one(e, ad, &val, NULL );
oc = *main->co_oc;
oc = main->co_oc;
if ( oc->soc_required )
config_build_attrs( e, oc->soc_required, ad, main->co_table, c );
......@@ -3662,7 +3659,7 @@ config_build_entry( Operation *op, SlapReply *rs, CfEntryInfo *parent,
config_build_attrs( e, oc->soc_allowed, ad, main->co_table, c );
if ( extra ) {
oc = *extra->co_oc;
oc = extra->co_oc;
if ( oc->soc_required )
config_build_attrs( e, oc->soc_required, ad, main->co_table, c );
......@@ -3805,6 +3802,7 @@ config_back_db_open( BackendDB *be )
/* create root of tree */
rdn = config_rdn;
c.private = cfb->cb_config;
c.be = frontendDB;
e = config_build_entry( op, &rs, NULL, &c, &rdn, &CFOC_GLOBAL, NULL );
ce = e->e_private;
cfb->cb_root = ce;
......
......@@ -464,9 +464,7 @@ init_config_ocs( ConfigOCs *ocs ) {
ocs[i].co_def, scherr2str(code), err );
return code;
}
if ( ocs[i].co_oc ) {
*ocs[i].co_oc = oc_find(oc->oc_names[0]);
}
ocs[i].co_oc = oc_find(oc->oc_names[0]);
ldap_memfree(oc);
}
return 0;
......@@ -602,7 +600,7 @@ read_config_file(const char *fname, int depth, ConfigArgs *cf, ConfigTable *cft)
} else if ( c->bi ) {
rc = SLAP_CONF_UNKNOWN;
if ( c->bi->bi_cf_ocs->co_table ) {
if ( c->bi->bi_cf_ocs ) {
ct = config_find_keyword( c->bi->bi_cf_ocs->co_table, c );
if ( ct ) {
rc = config_add_vals( ct, c );
......
......@@ -92,10 +92,10 @@ typedef int (ConfigCfAdd)(
typedef struct ConfigOCs {
char *co_def;
ConfigType co_type;
ObjectClass **co_oc;
ConfigTable *co_table;
ConfigLDAPadd *co_ldadd;
ConfigCfAdd *co_cfadd;
ObjectClass *co_oc;
struct berval *co_name;
} ConfigOCs;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment