From: Timo Sirainen Date: Fri, 8 Nov 2024 10:18:41 +0000 (+0200) Subject: config: Rename config_filter.service to protocol X-Git-Tag: 2.4.0~237 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cc0e0c5d44edab3736582d108352cc461ceb4228;p=thirdparty%2Fdovecot%2Fcore.git config: Rename config_filter.service to protocol --- diff --git a/src/config/config-dump-full.c b/src/config/config-dump-full.c index fd4d8ab035..b81850dad6 100644 --- a/src/config/config-dump-full.c +++ b/src/config/config-dump-full.c @@ -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++; diff --git a/src/config/config-filter.c b/src/config/config-filter.c index 873c454ed9..7a585a2b5b 100644 --- a/src/config/config-filter.c +++ b/src/config/config-filter.c @@ -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) diff --git a/src/config/config-filter.h b/src/config/config-filter.h index 56200559b3..5c75d7b873 100644 --- a/src/config/config-filter.h +++ b/src/config/config-filter.h @@ -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; diff --git a/src/config/config-parser.c b/src/config/config-parser.c index 40e4b26be6..3b71b0e64c 100644 --- a/src/config/config-parser.c +++ b/src/config/config-parser.c @@ -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 = §ion->filter_parser->filter; do { - if (filter->service != NULL || + if (filter->protocol != NULL || filter->local_name != NULL || filter->local_host != NULL || filter->remote_host != NULL || diff --git a/src/config/doveconf.c b/src/config/doveconf.c index 4ada152f06..14375367c6 100644 --- a/src/config/doveconf.c +++ b/src/config/doveconf.c @@ -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); diff --git a/src/config/old-set-parser.c b/src/config/old-set-parser.c index b289f05ce7..8cf583143d 100644 --- a/src/config/old-set-parser.c +++ b/src/config/old-set-parser.c @@ -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 {