]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
config: Fix autoprefixing section names under named list filters
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 27 Jan 2025 13:49:54 +0000 (15:49 +0200)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Wed, 12 Feb 2025 10:34:16 +0000 (12:34 +0200)
For example this didn't work:
userdb ldap {
  iterate_fields {

It only tested userdb_iterate_fields, not userdb_ldap_iterate_fields.

src/config/config-parser.c

index cdf60e882579a6cad51c5c63c3bdc1d07c53dceb..9a9af4ed2b9147c2e992f717fb11a30d5fff1453 100644 (file)
@@ -2659,11 +2659,17 @@ void config_parser_apply_line(struct config_parser_context *ctx,
                const char *key = line->key;
                if (cur_filter->filter_name != NULL) {
                        const char *filter_key =
-                               t_strcut(cur_filter->filter_name, '/');
+                               t_str_replace(cur_filter->filter_name, '/', '_');
                        const char *key2 = t_strdup_printf("%s_%s",
                                                           filter_key, key);
                        if (config_key_can_autoprefix(ctx, key2))
                                key = key2;
+                       else {
+                               filter_key = t_strcut(cur_filter->filter_name, '/');
+                               key2 = t_strdup_printf("%s_%s", filter_key, key);
+                               if (config_key_can_autoprefix(ctx, key2))
+                                       key = key2;
+                       }
                } else {
                        i_assert(!cur_filter->filter_name_array);
                }