From 33ef806e0d378a0b2326cd939714c9070502d1e5 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Tue, 4 Jan 2011 13:57:33 +0200 Subject: [PATCH] config: Give clear error that auth settings aren't supported inside local/remote blocks. --- src/config/config-parser.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/config/config-parser.c b/src/config/config-parser.c index 706e1e398a..5314feebe0 100644 --- a/src/config/config-parser.c +++ b/src/config/config-parser.c @@ -74,6 +74,15 @@ static void config_add_type(struct setting_parser_context *parser, i_assert(ret > 0); } +static bool +config_parser_is_in_localremote(struct config_section_stack *section) +{ + const struct config_filter *filter = §ion->filter; + + return filter->local_name != NULL || filter->local_bits > 0 || + filter->remote_bits > 0; +} + int config_apply_line(struct config_parser_context *ctx, const char *key, const char *line, const char *section_name) { @@ -85,6 +94,14 @@ int config_apply_line(struct config_parser_context *ctx, const char *key, ret = settings_parse_line(l->parser, line); if (ret > 0) { found = TRUE; + /* FIXME: remove once auth does support these. */ + if (strcmp(l->root->module_name, "auth") == 0 && + config_parser_is_in_localremote(ctx->cur_section)) { + ctx->error = p_strconcat(ctx->pool, + "Auth settings not supported inside local/remote blocks: ", + key, NULL); + return -1; + } if (section_name != NULL) config_add_type(l->parser, line, section_name); } else if (ret < 0) { -- 2.47.3