From: Timo Sirainen Date: Mon, 9 Jan 2023 14:16:36 +0000 (+0200) Subject: config: Remove last traces of modules based filtering X-Git-Tag: 2.4.0~3052 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2874988bbc5b0cdb5e869d0cb7f7283fa1876f89;p=thirdparty%2Fdovecot%2Fcore.git config: Remove last traces of modules based filtering --- diff --git a/src/config/config-parser-private.h b/src/config/config-parser-private.h index 9fe98cee54..ec16b04050 100644 --- a/src/config/config-parser-private.h +++ b/src/config/config-parser-private.h @@ -42,7 +42,6 @@ struct input_stack { struct config_parser_context { pool_t pool; const char *path; - const char *const *modules; ARRAY(struct config_filter_parser *) all_parsers; struct config_module_parser *root_parsers; diff --git a/src/config/config-parser.c b/src/config/config-parser.c index e5723bae1b..47bfff3428 100644 --- a/src/config/config-parser.c +++ b/src/config/config-parser.c @@ -364,11 +364,6 @@ config_filter_parser_check(struct config_parser_context *ctx, bool ok; for (; p->root != NULL; p++) { - /* skip checking settings we don't care about */ - if (!config_module_want_parser(ctx->root_parsers, - ctx->modules, p->root)) - continue; - settings_parse_var_skip(p->parser); T_BEGIN { ok = settings_parser_check(p->parser, ctx->pool, &error); @@ -773,23 +768,6 @@ config_get_value(struct config_section_stack *section, const char *key, return NULL; } -static bool -config_require_key(struct config_parser_context *ctx, const char *key) -{ - struct config_module_parser *l; - - if (ctx->modules == NULL) - return TRUE; - - for (l = ctx->cur_section->parsers; l->root != NULL; l++) { - if (config_module_want_parser(ctx->root_parsers, - ctx->modules, l->root) && - settings_parse_is_valid_key(l->parser, key)) - return TRUE; - } - return FALSE; -} - static int config_write_keyvariable(struct config_parser_context *ctx, const char *key, const char *value, string_t *str) @@ -876,15 +854,11 @@ static int config_write_value(struct config_parser_context *ctx, str_append_c(str, '<'); str_append(str, value); } else { - if (!config_require_key(ctx, full_key)) { - /* don't even try to open the file */ - } else { - path = fix_relative_path(value, ctx->cur_input); - if (str_append_file(str, full_key, path, &error) < 0) { - /* file reading failed */ - ctx->error = p_strdup(ctx->pool, error); - return -1; - } + path = fix_relative_path(value, ctx->cur_input); + if (str_append_file(str, full_key, path, &error) < 0) { + /* file reading failed */ + ctx->error = p_strdup(ctx->pool, error); + return -1; } } break; @@ -1156,53 +1130,6 @@ void config_parse_load_modules(void) } } -static bool parsers_are_connected(const struct setting_parser_info *root, - const struct setting_parser_info *info) -{ - const struct setting_parser_info *p; - const struct setting_parser_info *const *dep; - - /* we're trying to find info or its parents from root's dependencies. */ - - for (p = info; p != NULL; p = p->parent) { - if (p == root) - return TRUE; - } - - if (root->dependencies != NULL) { - for (dep = root->dependencies; *dep != NULL; dep++) { - if (parsers_are_connected(*dep, info)) - return TRUE; - } - } - return FALSE; -} - -bool config_module_want_parser(struct config_module_parser *parsers, - const char *const *modules, - const struct setting_parser_info *root) -{ - struct config_module_parser *l; - - if (modules == NULL) - return TRUE; - if (root == &master_service_setting_parser_info) { - /* everyone wants master service settings */ - return TRUE; - } - - for (l = parsers; l->root != NULL; l++) { - if (!str_array_find(modules, l->root->module_name)) - continue; - - /* see if we can find a way to get from the original parser - to this parser */ - if (parsers_are_connected(l->root, root)) - return TRUE; - } - return FALSE; -} - void config_parser_deinit(void) { if (array_is_created(&services_free_at_deinit)) diff --git a/src/config/config-parser.h b/src/config/config-parser.h index 4df3821124..5d11adaf44 100644 --- a/src/config/config-parser.h +++ b/src/config/config-parser.h @@ -28,10 +28,6 @@ int config_parse_file(const char *path, enum config_parse_flags flags, void config_parse_load_modules(void); -bool config_module_want_parser(struct config_module_parser *parsers, - const char *const *modules, - const struct setting_parser_info *root) - ATTR_NULL(2); void config_parser_deinit(void); #endif