]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
config parser: Log an error about missing '}'.
authorTimo Sirainen <tss@iki.fi>
Thu, 4 Nov 2010 15:47:37 +0000 (15:47 +0000)
committerTimo Sirainen <tss@iki.fi>
Thu, 4 Nov 2010 15:47:37 +0000 (15:47 +0000)
src/config/config-parser-private.h
src/config/config-parser.c

index 49849e4c6be340364b46858df37e946a8c8fbeb9..fca68e1f6aaf077ab811f97af78a577fa037755b 100644 (file)
@@ -23,6 +23,9 @@ struct config_section_stack {
        /* root=NULL-terminated list of parsers */
        struct config_module_parser *parsers;
        unsigned int pathlen;
+
+       const char *open_path;
+       unsigned int open_linenum;
 };
 
 struct input_stack {
index bd007adeb4ebaa584967495a5f6c6db2a9ab264a..706e1e398a74a262f3630554b7d6bbf81d7adc48 100644 (file)
@@ -165,6 +165,9 @@ config_add_new_section(struct config_parser_context *ctx)
        section->prev = ctx->cur_section;
        section->filter = ctx->cur_section->filter;
        section->parsers = ctx->cur_section->parsers;
+
+       section->open_path = p_strdup(ctx->pool, ctx->cur_input->path);
+       section->open_linenum = ctx->cur_input->linenum;
        return section;
 }
 
@@ -312,6 +315,14 @@ config_all_parsers_check(struct config_parser_context *ctx,
        pool_t tmp_pool;
        int ret = 0;
 
+       if (ctx->cur_section->prev != NULL) {
+               *error_r = t_strdup_printf(
+                       "Missing '}' (section started at %s:%u)",
+                       ctx->cur_section->open_path,
+                       ctx->cur_section->open_linenum);
+               return -1;
+       }
+
        tmp_pool = pool_alloconly_create("config parsers check", 1024*32);
        parsers = array_get(&ctx->all_parsers, &count);
        i_assert(count > 0 && parsers[count-1] == NULL);