]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
config: Remove last traces of modules based filtering
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 9 Jan 2023 14:16:36 +0000 (16:16 +0200)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Fri, 27 Jan 2023 13:01:47 +0000 (13:01 +0000)
src/config/config-parser-private.h
src/config/config-parser.c
src/config/config-parser.h

index 9fe98cee54c594af97c666bb4576f7188e1abbae..ec16b040508d544d482d15f37cc8b2a5443c9adb 100644 (file)
@@ -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;
index e5723bae1b896cae2a00d1a36483c4bc9d88da76..47bfff342843d8c66c46005b0fce94dc5099c02e 100644 (file)
@@ -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))
index 4df3821124334e763788232f2a604a948a6a1e8c..5d11adaf44655179a4cd6ec1f36a9054c66ae421 100644 (file)
@@ -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