From: Timo Sirainen Date: Mon, 3 Nov 2025 08:22:19 +0000 (+0200) Subject: config: Fail if trying to use non-strlist and non-boollist setting as a section X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4370e69bd498cf4984679932e53183c06223c803;p=thirdparty%2Fdovecot%2Fcore.git config: Fail if trying to use non-strlist and non-boollist setting as a section For example this was silently ignored: mail_driver { } --- diff --git a/src/config/config-parser.c b/src/config/config-parser.c index 1dd04aca9d..91e5fdaf85 100644 --- a/src/config/config-parser.c +++ b/src/config/config-parser.c @@ -3235,7 +3235,9 @@ void config_parser_apply_line(struct config_parser_context *ctx, /* new filter or error */ break; } - if (hash_table_lookup(ctx->all_keys, key) == NULL) { + const struct config_parser_key *config_key = + hash_table_lookup(ctx->all_keys, key); + if (config_key == NULL) { if ((ctx->flags & CONFIG_PARSE_FLAG_IGNORE_UNKNOWN) != 0) break; if (attempts != NULL) @@ -3246,7 +3248,13 @@ void config_parser_apply_line(struct config_parser_context *ctx, break; } - /* This is SET_STRLIST or SET_BOOLLIST */ + /* This should be SET_STRLIST or SET_BOOLLIST */ + const struct setting_define *def = + &all_infos[config_key->info_idx]->defines[config_key->define_idx]; + if (def->type != SET_STRLIST && def->type != SET_BOOLLIST) { + ctx->error = p_strdup_printf(ctx->pool, + "Setting %s cannot be used as a section", key); + } break; } case CONFIG_LINE_TYPE_SECTION_END: