]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-settings, config: Remove SET_FILTER_HIERARCHY
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 8 Jan 2024 03:58:18 +0000 (22:58 -0500)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Wed, 12 Feb 2025 10:34:11 +0000 (12:34 +0200)
Now that lib-fs is configured with named list filters, there is no more need
for this type of a hierarchical setting.

src/config/config-dump-full.c
src/config/config-filter.h
src/config/config-parser.c
src/config/config-request.c
src/lib-settings/settings-parser.c
src/lib-settings/settings-parser.h
src/lib-settings/settings.c

index bd73cb5a578ebbde60b1161f8cd07309bebc1552..5c84a15b2a5bf6222c0768e73d0e27cba481b814 100644 (file)
@@ -78,23 +78,10 @@ static int output_blob_size(struct ostream *output, uoff_t blob_size_offset)
        return 0;
 }
 
-static void
-config_filter_write_hierarchical(string_t *str,
-                                const struct config_filter *filter)
-{
-       if (filter == NULL || !filter->filter_hierarchical)
-               return;
-       if (str_len(str) > 0)
-               str_append_c(str, '/');
-       str_append(str, filter->filter_name);
-       config_filter_write_hierarchical(str, filter->parent);
-}
-
 static void
 config_dump_full_append_filter_query(string_t *str,
                                     const struct config_filter *filter,
-                                    bool leaf, bool parent_hierarchical,
-                                    bool write_named_filters)
+                                    bool leaf, bool write_named_filters)
 {
        if (filter->service != NULL) {
                if (filter->service[0] != '!') {
@@ -141,20 +128,7 @@ config_dump_full_append_filter_query(string_t *str,
        } else if (filter->filter_name != NULL) {
                const char *filter_name = filter->filter_name;
 
-               if (!parent_hierarchical &&
-                   filter->filter_hierarchical &&
-                   filter->parent->filter_hierarchical) {
-                       /* beginning of a hierarchical filter. */
-                       string_t *str = t_str_new(128);
-                       config_filter_write_hierarchical(str, filter);
-                       filter_name = str_c(str);
-               } else if (parent_hierarchical &&
-                          filter->filter_hierarchical) {
-                       /* hierarchical filter was already written. */
-                       return;
-               }
-
-               if (write_named_filters || filter->filter_hierarchical) {
+               if (write_named_filters) {
                        str_printfa(str, SETTINGS_EVENT_FILTER_NAME"=\"%s\" AND ",
                                    wildcard_str_escape(filter_name));
                }
@@ -167,14 +141,11 @@ config_dump_full_append_filter(string_t *str,
                               bool write_named_filters)
 {
        bool leaf = TRUE;
-       bool parent_hierarchical = FALSE;
 
        do {
                config_dump_full_append_filter_query(str, filter, leaf,
-                                                    parent_hierarchical,
                                                     write_named_filters);
                leaf = FALSE;
-               parent_hierarchical = filter->filter_hierarchical;
                filter = filter->parent;
        } while (filter != NULL);
 
index bd0ed4609df7bef9daa29bbbc9a95cb1e652a1db..915b5e6b56e312937e33915fa372c43d3e4f0823 100644 (file)
@@ -22,10 +22,6 @@ struct config_filter {
        const char *filter_name;
        /* named_list_filter key { .. } */
        bool filter_name_array;
-       /* This filter is hierarchical. If a child event is also hierarchical,
-          their filter_names will be merged into one filter path when dumping
-          the config. */
-       bool filter_hierarchical;
 
        /* TRUE if default settings are being accessed. These will be stored in
           separate filters so they can be ordered before global settings. */
index 13cced92099828b7818caa878aabf7539a597d4f..98e9ae15a59e4c62874caea37b060187c1edd80c 100644 (file)
@@ -405,7 +405,6 @@ settings_value_check(struct config_parser_context *ctx,
        case SET_FILTER_ARRAY:
                break;
        case SET_FILTER_NAME:
-       case SET_FILTER_HIERARCHY:
                ctx->error = p_strdup_printf(ctx->pool,
                        "Setting is a named filter, use '%s {'", def->key);
                return -1;
@@ -428,7 +427,6 @@ config_is_filter_name(struct config_parser_context *ctx, const char *key,
 
        def = &all_infos[config_key->info_idx]->defines[config_key->define_idx];
        if (def->type != SET_FILTER_NAME &&
-           def->type != SET_FILTER_HIERARCHY &&
            def->type != SET_FILTER_ARRAY)
                return FALSE;
 
@@ -687,8 +685,7 @@ again:
                        /* Verify that this is a filter_name/ prefix. If not,
                           it should be a list/ */
                        if (l->info->defines[config_key->define_idx].type != SET_FILTER_NAME &&
-                           l->info->defines[config_key->define_idx].type != SET_FILTER_ARRAY &&
-                           l->info->defines[config_key->define_idx].type != SET_FILTER_HIERARCHY)
+                           l->info->defines[config_key->define_idx].type != SET_FILTER_ARRAY)
                                break;
 
                        filter.filter_name =
@@ -1007,16 +1004,13 @@ config_filter_add_new_filter(struct config_parser_context *ctx,
                else
                        filter.remote_host = p_strdup(ctx->pool, value);
        } else if (config_is_filter_name(ctx, key, &filter_def)) {
-               if (filter_def->type == SET_FILTER_NAME ||
-                   filter_def->type == SET_FILTER_HIERARCHY) {
+               if (filter_def->type == SET_FILTER_NAME) {
                        if (value[0] != '\0' || value_quoted) {
                                ctx->error = p_strdup_printf(ctx->pool,
                                        "%s { } must not have a section name",
                                        key);
                                return TRUE;
                        }
-                       if (filter_def->type == SET_FILTER_HIERARCHY)
-                               filter.filter_hierarchical = TRUE;
                        filter.filter_name = p_strdup(ctx->pool, key);
                } else {
                        if (strcmp(key, "namespace") == 0 &&
index 28e86ecd19d889904144f855aacf04343a3f897a..e6e5549e81a1ffff46cc9004d7a7fddf7035fb14 100644 (file)
@@ -312,7 +312,6 @@ settings_export(struct config_export_context *ctx,
                        break;
                }
                case SET_FILTER_NAME:
-               case SET_FILTER_HIERARCHY:
                case SET_ALIAS:
                        break;
                }
index 44c7143ae161bf5a1851957f6f83d5ebfdbe107a..133780ed7dbab6a7f682912855e3a43e56e26a66 100644 (file)
@@ -570,7 +570,6 @@ settings_parse(struct setting_parser_context *ctx,
                break;
        }
        case SET_FILTER_NAME:
-       case SET_FILTER_HIERARCHY:
                settings_parser_set_error(ctx, t_strdup_printf(
                        "Setting is a named filter, use '%s {'", key));
                return -1;
@@ -589,8 +588,7 @@ settings_find_key(struct setting_parser_context *ctx, const char *key,
 
        /* try to find the exact key */
        def = setting_define_find(ctx->info, key);
-       if (def != NULL && ((def->type != SET_FILTER_NAME &&
-                            def->type != SET_FILTER_HIERARCHY) ||
+       if (def != NULL && (def->type != SET_FILTER_NAME ||
                            allow_filter_name)) {
                *def_r = def;
                return TRUE;
index 2ac181565deffc9c0703837643a60ad658d6144a..b2488fee53ab64688790f3080fb7d73c5ee27c1d 100644 (file)
@@ -34,7 +34,6 @@ enum setting_type {
        SET_BOOLLIST, /* of type ARRAY_TYPE(const_string) - guaranteed NULL-terminted */
        SET_ALIAS, /* alias name for above setting definition */
        SET_FILTER_NAME,
-       SET_FILTER_HIERARCHY,
        SET_FILTER_ARRAY,
 };
 enum setting_flags {
index 48bb59445218902df628fa28b916bd0c7b135a33..23e1dcc9e679241eb852f778c0d121228a8990c9 100644 (file)
@@ -1174,28 +1174,6 @@ settings_override_filter_match(struct settings_apply_ctx *ctx,
                                      SETTINGS_EVENT_FILTER_NAME,
                                      last_filter_key);
                        break;
-               case SET_FILTER_HIERARCHY: {
-                       /* add the full repeated hierarchy here */
-                       const char *next;
-
-                       str_printfa(filter_string, SETTINGS_EVENT_FILTER_NAME"=\"%s",
-                                   wildcard_str_escape(part));
-                       while (str_begins(p + 1, part, &next) &&
-                              next[0] == SETTINGS_SEPARATOR) {
-                               str_append_c(filter_string, '/');
-                               str_append(filter_string,
-                                          wildcard_str_escape(part));
-                               p = next;
-                       }
-                       str_append_c(filter_string, '"');
-
-                       last_filter_key = t_strdup_until(set->key, p);
-                       last_filter_value = NULL;
-                       event_add_str(set->filter_event,
-                                     SETTINGS_EVENT_FILTER_NAME,
-                                     last_filter_key);
-                       break;
-               }
                case SET_FILTER_ARRAY: {
                        const char *value = p + 1;
                        p = strchr(value, SETTINGS_SEPARATOR);