X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fbconfig.c;h=bf13855d9dd72b280db5dd5bad2f2d6287f5b8b5;hb=f57a216f1cb425e208b5609e1b0451e988583ce1;hp=7dee51a505810a064e41b55a5a4529edcff6be6b;hpb=9992d5c43a31265cf840d3972eb132732f8dccf2;p=openldap diff --git a/servers/slapd/bconfig.c b/servers/slapd/bconfig.c index 7dee51a505..bf13855d9d 100644 --- a/servers/slapd/bconfig.c +++ b/servers/slapd/bconfig.c @@ -2208,14 +2208,23 @@ config_sizelimit(ConfigArgs *c) { rc = 1; return rc; } else if ( c->op == LDAP_MOD_DELETE ) { - /* Reset to defaults */ - lim->lms_s_soft = SLAPD_DEFAULT_SIZELIMIT; - lim->lms_s_hard = 0; - lim->lms_s_unchecked = -1; - lim->lms_s_pr = 0; - lim->lms_s_pr_hide = 0; - lim->lms_s_pr_total = 0; - return 0; + /* Reset to defaults or values from frontend */ + if ( c->be == frontendDB ) { + lim->lms_s_soft = SLAPD_DEFAULT_SIZELIMIT; + lim->lms_s_hard = 0; + lim->lms_s_unchecked = -1; + lim->lms_s_pr = 0; + lim->lms_s_pr_hide = 0; + lim->lms_s_pr_total = 0; + } else { + lim->lms_s_soft = frontendDB->be_def_limit.lms_s_soft; + lim->lms_s_hard = frontendDB->be_def_limit.lms_s_hard; + lim->lms_s_unchecked = frontendDB->be_def_limit.lms_s_unchecked; + lim->lms_s_pr = frontendDB->be_def_limit.lms_s_pr; + lim->lms_s_pr_hide = frontendDB->be_def_limit.lms_s_pr_hide; + lim->lms_s_pr_total = frontendDB->be_def_limit.lms_s_pr_total; + } + goto ok; } for(i = 1; i < c->argc; i++) { if(!strncasecmp(c->argv[i], "size", 4)) { @@ -2240,6 +2249,35 @@ config_sizelimit(ConfigArgs *c) { lim->lms_s_hard = 0; } } + +ok: + if ( ( c->be == frontendDB ) && ( c->ca_entry ) ) { + /* This is a modification to the global limits apply it to + * the other databases as needed */ + AttributeDescription *ad=NULL; + const char *text = NULL; + CfEntryInfo *ce = c->ca_entry->e_private; + + slap_str2ad(c->argv[0], &ad, &text); + /* if we got here... */ + assert( ad != NULL ); + + if ( ce->ce_type == Cft_Global ){ + ce = ce->ce_kids; + } + for (; ce; ce=ce->ce_sibs) { + Entry *dbe = ce->ce_entry; + if ( (ce->ce_type == Cft_Database) && (ce->ce_be != frontendDB) + && (!attr_find(dbe->e_attrs, ad)) ) { + ce->ce_be->be_def_limit.lms_s_soft = lim->lms_s_soft; + ce->ce_be->be_def_limit.lms_s_hard = lim->lms_s_hard; + ce->ce_be->be_def_limit.lms_s_unchecked =lim->lms_s_unchecked; + ce->ce_be->be_def_limit.lms_s_pr =lim->lms_s_pr; + ce->ce_be->be_def_limit.lms_s_pr_hide =lim->lms_s_pr_hide; + ce->ce_be->be_def_limit.lms_s_pr_total =lim->lms_s_pr_total; + } + } + } return(0); } @@ -2259,10 +2297,15 @@ config_timelimit(ConfigArgs *c) { rc = 1; return rc; } else if ( c->op == LDAP_MOD_DELETE ) { - /* Reset to defaults */ - lim->lms_t_soft = SLAPD_DEFAULT_TIMELIMIT; - lim->lms_t_hard = 0; - return 0; + /* Reset to defaults or values from frontend */ + if ( c->be == frontendDB ) { + lim->lms_t_soft = SLAPD_DEFAULT_TIMELIMIT; + lim->lms_t_hard = 0; + } else { + lim->lms_t_soft = frontendDB->be_def_limit.lms_t_soft; + lim->lms_t_hard = frontendDB->be_def_limit.lms_t_hard; + } + goto ok; } for(i = 1; i < c->argc; i++) { if(!strncasecmp(c->argv[i], "time", 4)) { @@ -2287,6 +2330,31 @@ config_timelimit(ConfigArgs *c) { lim->lms_t_hard = 0; } } + +ok: + if ( ( c->be == frontendDB ) && ( c->ca_entry ) ) { + /* This is a modification to the global limits apply it to + * the other databases as needed */ + AttributeDescription *ad=NULL; + const char *text = NULL; + CfEntryInfo *ce = c->ca_entry->e_private; + + slap_str2ad(c->argv[0], &ad, &text); + /* if we got here... */ + assert( ad != NULL ); + + if ( ce->ce_type == Cft_Global ){ + ce = ce->ce_kids; + } + for (; ce; ce=ce->ce_sibs) { + Entry *dbe = ce->ce_entry; + if ( (ce->ce_type == Cft_Database) && (ce->ce_be != frontendDB) + && (!attr_find(dbe->e_attrs, ad)) ) { + ce->ce_be->be_def_limit.lms_t_soft = lim->lms_t_soft; + ce->ce_be->be_def_limit.lms_t_hard = lim->lms_t_hard; + } + } + } return(0); } @@ -4932,10 +5000,10 @@ config_add_internal( CfBackInfo *cfb, Entry *e, ConfigArgs *ca, SlapReply *rs, ok: /* Newly added databases and overlays need to be started up */ if ( CONFIG_ONLINE_ADD( ca )) { - if ( colst[0]->co_type == Cft_Database ) { + if ( coptr->co_type == Cft_Database ) { rc = backend_startup_one( ca->be, &ca->reply ); - } else if ( colst[0]->co_type == Cft_Overlay ) { + } else if ( coptr->co_type == Cft_Overlay ) { if ( ca->bi->bi_db_open ) { BackendInfo *bi_orig = ca->be->bd_info; ca->be->bd_info = ca->bi; @@ -4961,7 +5029,7 @@ ok: ce->ce_parent = last; ce->ce_entry = entry_dup( e ); ce->ce_entry->e_private = ce; - ce->ce_type = colst[0]->co_type; + ce->ce_type = coptr->co_type; ce->ce_be = ca->be; ce->ce_bi = ca->bi; ce->ce_private = ca->ca_private; @@ -5006,12 +5074,12 @@ ok: done: if ( rc ) { - if ( (colst[0]->co_type == Cft_Database) && ca->be ) { + if ( (coptr->co_type == Cft_Database) && ca->be ) { if ( ca->be != frontendDB ) backend_destroy_one( ca->be, 1 ); - } else if ( (colst[0]->co_type == Cft_Overlay) && ca->bi ) { + } else if ( (coptr->co_type == Cft_Overlay) && ca->bi ) { overlay_destroy_one( ca->be, (slap_overinst *)ca->bi ); - } else if ( colst[0]->co_type == Cft_Schema ) { + } else if ( coptr->co_type == Cft_Schema ) { schema_destroy_one( ca, colst, nocs, last ); } } @@ -6735,10 +6803,30 @@ config_tool_entry_first( BackendDB *be ) CfBackInfo *cfb = be->be_private; BackendInfo *bi = cfb->cb_db.bd_info; - if ( bi && bi->bi_tool_entry_first ) + if ( bi && bi->bi_tool_entry_first ) { return bi->bi_tool_entry_first( &cfb->cb_db ); - else - return NOID; + } + if ( bi && bi->bi_tool_entry_first_x ) { + return bi->bi_tool_entry_first_x( &cfb->cb_db, + NULL, LDAP_SCOPE_DEFAULT, NULL ); + } + return NOID; +} + +static ID +config_tool_entry_first_x( + BackendDB *be, + struct berval *base, + int scope, + Filter *f ) +{ + CfBackInfo *cfb = be->be_private; + BackendInfo *bi = cfb->cb_db.bd_info; + + if ( bi && bi->bi_tool_entry_first_x ) { + return bi->bi_tool_entry_first_x( &cfb->cb_db, base, scope, f ); + } + return NOID; } static ID @@ -6985,6 +7073,7 @@ config_back_initialize( BackendInfo *bi ) bi->bi_tool_entry_open = config_tool_entry_open; bi->bi_tool_entry_close = config_tool_entry_close; bi->bi_tool_entry_first = config_tool_entry_first; + bi->bi_tool_entry_first_x = config_tool_entry_first_x; bi->bi_tool_entry_next = config_tool_entry_next; bi->bi_tool_entry_get = config_tool_entry_get; bi->bi_tool_entry_put = config_tool_entry_put;