]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
config: Rename config_filter.service to protocol
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Fri, 8 Nov 2024 10:18:41 +0000 (12:18 +0200)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Fri, 17 Jan 2025 08:40:01 +0000 (10:40 +0200)
src/config/config-dump-full.c
src/config/config-filter.c
src/config/config-filter.h
src/config/config-parser.c
src/config/doveconf.c
src/config/old-set-parser.c

index fd4d8ab0357f9789a77be754e96e5856c849ee87..b81850dad6dd2c8f268eeb70d624a30729007069 100644 (file)
@@ -120,13 +120,13 @@ config_dump_full_append_filter_query(string_t *str,
                                     const struct config_filter *filter,
                                     bool write_named_filters)
 {
-       if (filter->service != NULL) {
-               if (filter->service[0] != '!') {
+       if (filter->protocol != NULL) {
+               if (filter->protocol[0] != '!') {
                        str_printfa(str, "protocol=\"%s\" AND ",
-                                   wildcard_str_escape(filter->service));
+                                   wildcard_str_escape(filter->protocol));
                } else {
                        str_printfa(str, "NOT protocol=\"%s\" AND ",
-                                   wildcard_str_escape(filter->service + 1));
+                                   wildcard_str_escape(filter->protocol + 1));
                }
        }
        if (filter->local_name != NULL) {
@@ -680,7 +680,7 @@ int config_dump_full(struct config_parsed *config,
 
        /* first filter should be the global one */
        i_assert(ctx.filters[0] != NULL &&
-                ctx.filters[0]->filter.service == NULL);
+                ctx.filters[0]->filter.protocol == NULL);
 
        uint32_t max_filter_count = 0;
        while (ctx.filters[max_filter_count] != NULL) max_filter_count++;
index 873c454ed91b8547baa7ea01be070da64f34f457..7a585a2b5bb90eee56f8ad336febbdd88a22d16d 100644 (file)
@@ -16,15 +16,15 @@ static const struct config_filter empty_defaults_filter = {
 static int config_filter_match_service(const struct config_filter *mask,
                                       const struct config_filter *filter)
 {
-       if (mask->service != NULL) {
-               if (filter->service == NULL)
+       if (mask->protocol != NULL) {
+               if (filter->protocol == NULL)
                        return -1;
-               if (mask->service[0] == '!') {
-                       /* not service */
-                       if (strcmp(filter->service, mask->service + 1) == 0)
+               if (mask->protocol[0] == '!') {
+                       /* not protocol */
+                       if (strcmp(filter->protocol, mask->protocol + 1) == 0)
                                return 0;
                } else {
-                       if (strcmp(filter->service, mask->service) != 0)
+                       if (strcmp(filter->protocol, mask->protocol) != 0)
                                return 0;
                }
        }
@@ -110,7 +110,7 @@ bool config_filter_match(const struct config_filter *mask,
 bool config_filters_equal_no_recursion(const struct config_filter *f1,
                                       const struct config_filter *f2)
 {
-       if (null_strcmp(f1->service, f2->service) != 0)
+       if (null_strcmp(f1->protocol, f2->protocol) != 0)
                return FALSE;
 
        if (f1->remote_bits != f2->remote_bits)
index 56200559b30259f758dd02c38e6d0e6e4d84ec50..5c75d7b8735fb8a93ede511e60444d88dfb0d4e3 100644 (file)
@@ -9,7 +9,7 @@ struct config_filter {
        /* Parent filter, which is ANDed to this filter */
        struct config_filter *parent;
 
-       const char *service;
+       const char *protocol;
        /* local_name is for TLS SNI requests.
           both local_name and local_bits can't be set at the same time. */
        const char *local_name;
index 40e4b26be6b0d220ef089cbb37e59fd9442fafac..3b71b0e64c8eff953b526c7a2e53c2f3be8afbd3 100644 (file)
@@ -1133,7 +1133,7 @@ int config_filter_parse(struct config_filter *filter, pool_t pool,
                        p_strdup_printf(pool, "%s/%s", key, value);
                filter->filter_name_array = TRUE;
        } else if (strcmp(key, "protocol") == 0) {
-               if (parent->service != NULL)
+               if (parent->protocol != NULL)
                        *error_r = "Nested protocol { protocol { .. } } block not allowed";
                else if (parent->filter_name != NULL)
                        *error_r = t_strdup_printf(
@@ -1141,11 +1141,11 @@ int config_filter_parse(struct config_filter *filter, pool_t pool,
                                t_strcut(parent->filter_name, '/'),
                                t_strcut(parent->filter_name, '/'));
                else
-                       filter->service = p_strdup(pool, value);
+                       filter->protocol = p_strdup(pool, value);
        } else if (strcmp(key, "local") == 0) {
                if (parent->remote_bits > 0)
                        *error_r = "remote { local { .. } } not allowed (use local { remote { .. } } instead)";
-               else if (parent->service != NULL)
+               else if (parent->protocol != NULL)
                        *error_r = "protocol { local { .. } } not allowed (use local { protocol { .. } } instead)";
                else if (parent->local_name != NULL)
                        *error_r = "local_name { local { .. } } not allowed (use local { local_name { .. } } instead)";
@@ -1168,7 +1168,7 @@ int config_filter_parse(struct config_filter *filter, pool_t pool,
        } else if (strcmp(key, "local_name") == 0) {
                if (parent->remote_bits > 0)
                        *error_r = "remote { local_name { .. } } not allowed (use local_name { remote { .. } } instead)";
-               else if (parent->service != NULL)
+               else if (parent->protocol != NULL)
                        *error_r = "protocol { local_name { .. } } not allowed (use local_name { protocol { .. } } instead)";
                else if (parent->filter_name != NULL)
                        *error_r = p_strdup_printf(pool,
@@ -1178,7 +1178,7 @@ int config_filter_parse(struct config_filter *filter, pool_t pool,
                else
                        filter->local_name = p_strdup(pool, value);
        } else if (strcmp(key, "remote") == 0) {
-               if (parent->service != NULL)
+               if (parent->protocol != NULL)
                        *error_r = "protocol { remote { .. } } not allowed (use remote { protocol { .. } } instead)";
                else if (parent->filter_name != NULL)
                        *error_r = p_strdup_printf(pool,
@@ -1387,8 +1387,8 @@ config_filter_parser_check(struct config_parser_context *ctx,
 
        event = event_create(event);
        for (filter = &filter_parser->filter; filter != NULL; filter = filter->parent) {
-               if (filter->service != NULL)
-                       event_add_str(event, "protocol", filter->service);
+               if (filter->protocol != NULL)
+                       event_add_str(event, "protocol", filter->protocol);
                if (filter->local_name != NULL)
                        event_add_str(event, "local_name", filter->local_name);
                if (filter->local_bits > 0)
@@ -2320,7 +2320,7 @@ config_section_has_non_named_list_filters(struct config_section_stack *section)
        struct config_filter *filter = &section->filter_parser->filter;
 
        do {
-               if (filter->service != NULL ||
+               if (filter->protocol != NULL ||
                    filter->local_name != NULL ||
                    filter->local_host != NULL ||
                    filter->remote_host != NULL ||
index 4ada152f06372d92be19a47a8414615825bbe654..14375367c69e8f24adb42fe7522b9baea6175ebf 100644 (file)
@@ -692,9 +692,9 @@ config_dump_filter_begin(string_t *str, unsigned int indent,
                str_append(str, " {\n");
                indent++;
        }
-       if (filter->service != NULL) {
+       if (filter->protocol != NULL) {
                str_append_max(str, indent_str, indent*2);
-               str_printfa(str, "protocol %s {\n", filter->service);
+               str_printfa(str, "protocol %s {\n", filter->protocol);
                indent++;
        }
        config_dump_named_filters(str, &indent, filter);
index b289f05ce7e91e418032e26cfd1a6801785dbfdc..8cf583143dabfdd9255c90b3b2ac35b9576ee8a3 100644 (file)
@@ -25,13 +25,13 @@ struct old_set_parser {
 };
 
 static const struct config_filter imap_filter = {
-       .service = "imap"
+       .protocol = "imap"
 };
 static const struct config_filter pop3_filter = {
-       .service = "pop3"
+       .protocol = "pop3"
 };
 static const struct config_filter managesieve_filter = {
-       .service = "sieve"
+       .protocol = "sieve"
 };
 
 static const struct {