dovecot-2.0: config: Conflict handling fix.

dovecot at dovecot.org dovecot at dovecot.org
Sat Oct 10 01:45:43 EEST 2009


details:   http://hg.dovecot.org/dovecot-2.0/rev/85e532d170cc
changeset: 10024:85e532d170cc
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Oct 09 18:45:21 2009 -0400
description:
config: Conflict handling fix.

diffstat:

2 files changed, 14 insertions(+), 8 deletions(-)
src/config/config-filter.c |   10 +++++-----
src/config/config-parser.c |   12 +++++++++---

diffs (49 lines):

diff -r f69fda5d7af5 -r 85e532d170cc src/config/config-filter.c
--- a/src/config/config-filter.c	Fri Oct 09 17:55:57 2009 -0400
+++ b/src/config/config-filter.c	Fri Oct 09 18:45:21 2009 -0400
@@ -132,9 +132,9 @@ config_filter_is_superset(const struct c
 {
 	/* 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)
-		return FALSE;
-	if (sup->remote_bits < filter->remote_bits)
+	if (sup->local_bits > filter->local_bits)
+		return FALSE;
+	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 con
 
 	/* 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;
diff -r f69fda5d7af5 -r 85e532d170cc src/config/config-parser.c
--- a/src/config/config-parser.c	Fri Oct 09 17:55:57 2009 -0400
+++ b/src/config/config-parser.c	Fri Oct 09 18:45:21 2009 -0400
@@ -166,9 +166,15 @@ config_add_new_parser(struct parser_cont
 
 	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);


More information about the dovecot-cvs mailing list