]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
config: Require named list filter lookups to use settings_filter_name
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Wed, 22 Jan 2025 11:07:34 +0000 (13:07 +0200)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Wed, 12 Feb 2025 10:34:16 +0000 (12:34 +0200)
The config client callers are now responsible for doing lookups with e.g.
settings_filter_name=namespace/inbox in the event, rather than relying on
just namespace=inbox being in the event.

This allows separating the filter name from the setting values. So for
example userdb can change the mailbox name (mailbox/spam/name=Junk).

src/config/config-dump-full.c

index e5a6e48d2694dbf12e972a412305845c695f53e1..3ad3ae0db29beb9862300fcdadf42c9d7d154d12 100644 (file)
@@ -148,21 +148,14 @@ config_dump_full_append_filter_query(string_t *str,
                const char *p = strchr(filter->filter_name, '/');
                i_assert(p != NULL);
                const char *filter_key = t_strdup_until(filter->filter_name, p);
-               bool group = filter_key[0] == SETTINGS_INCLUDE_GROUP_PREFIX;
                if (strcmp(filter_key, SETTINGS_EVENT_MAILBOX_NAME_WITH_PREFIX) == 0)
                        filter_key = SETTINGS_EVENT_MAILBOX_NAME_WITHOUT_PREFIX;
-               if (!group) {
-                       str_printfa(str, "(%s=\"%s\" OR ",
-                                   filter_key, str_escape(p + 1));
-               }
                /* the filter_name is used by settings_get_filter() for
                   finding a specific filter without wildcards messing
                   up the lookups. */
                str_printfa(str, SETTINGS_EVENT_FILTER_NAME
                            "=\"%s/%s\"", filter_key,
                            wildcard_str_escape(settings_section_escape(p + 1)));
-               if (!group)
-                       str_append_c(str, ')');
                str_append(str, " AND ");
        } else if (filter->filter_name != NULL) {
                const char *filter_name = filter->filter_name;