]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
config: Assume config parser end hook wants to change default settings
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 31 Jul 2025 12:47:53 +0000 (15:47 +0300)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Sun, 3 Aug 2025 17:22:44 +0000 (17:22 +0000)
This is what Pigeonhole wants at least. This was already happening a bit
accidentally. Make thie explicit, because the next commit removes the
accidental method.

src/config/config-parser.c

index 91ace447c13a95a485465cb0b65a53e660b2dd4a..c830f0d24f932938ccf4f402ea15ba8b94909191 100644 (file)
@@ -1861,8 +1861,15 @@ config_all_parsers_check(struct config_parser_context *ctx,
 
        int ret = 0;
        if (hook_config_parser_end != NULL &&
-           (flags & CONFIG_PARSE_FLAG_EXTERNAL_HOOKS) != 0)
+           (flags & CONFIG_PARSE_FLAG_EXTERNAL_HOOKS) != 0) {
+               /* Assume the hooks want to update default settings */
+               struct config_filter_parser *defaults_parser =
+                       array_idx_elem(&ctx->all_filter_parsers, 1);
+               i_assert(config_filter_is_empty_defaults(&defaults_parser->filter));
+               ctx->cur_section->filter_parser = defaults_parser;
+
                ret = hook_config_parser_end(ctx, new_config, event, error_r);
+       }
 
        /* Run check_func()s for each filter independently. If you have
           protocol imap { ... local { ... } } blocks, it's going to check the