]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
config: Conflict handling fix.
authorTimo Sirainen <tss@iki.fi>
Fri, 9 Oct 2009 22:45:21 +0000 (18:45 -0400)
committerTimo Sirainen <tss@iki.fi>
Fri, 9 Oct 2009 22:45:21 +0000 (18:45 -0400)
--HG--
branch : HEAD

src/config/config-filter.c
src/config/config-parser.c

index 249376ee482f0f943cfd1e46e5ccdc3bfe16e352..9843f6d53b7117621d8ddc7ffe5cdf104256bb91 100644 (file)
@@ -132,9 +132,9 @@ config_filter_is_superset(const struct config_filter *sup,
 {
        /* assume that both of the filters match the same subset, so we don't
           need to compare IPs and service name. */
-       if (sup->local_bits < filter->local_bits)
+       if (sup->local_bits > filter->local_bits)
                return FALSE;
-       if (sup->remote_bits < filter->remote_bits)
+       if (sup->remote_bits > filter->remote_bits)
                return FALSE;
        if (sup->service != NULL && filter->service == NULL)
                return FALSE;
@@ -185,8 +185,8 @@ int config_filter_parsers_get(struct config_filter_context *ctx, pool_t pool,
 
        /* apply the changes from rest of the matches */
        for (i = 1; src[i] != NULL; i++) {
-               if (config_filter_is_superset(&src[i-1]->filter,
-                                             &src[i]->filter))
+               if (config_filter_is_superset(&src[i]->filter,
+                                             &src[i-1]->filter))
                        error_p = NULL;
                else
                        error_p = &error;
index 2ff711678d940f9be296537014bf3b0825b32ee5..3ff1cd8c298c4e49dc5b2ffa1e4781ae850520cd 100644 (file)
@@ -166,9 +166,15 @@ config_add_new_parser(struct parser_context *ctx)
 
        parser = p_new(ctx->pool, struct config_filter_parser, 1);
        parser->filter = cur_section->filter;
-       parser->file_and_line =
-               p_strdup_printf(ctx->pool, "%s:%d",
-                               ctx->cur_input->path, ctx->cur_input->linenum);
+       if (ctx->cur_input->linenum == 0) {
+               parser->file_and_line =
+                       p_strdup(ctx->pool, ctx->cur_input->path);
+       } else {
+               parser->file_and_line =
+                       p_strdup_printf(ctx->pool, "%s:%d",
+                                       ctx->cur_input->path,
+                                       ctx->cur_input->linenum);
+       }
        parser->parsers = cur_section->prev == NULL ? ctx->root_parsers :
                config_module_parsers_init(ctx->pool);
        array_append(&ctx->all_parsers, &parser, 1);