dovecot-2.2: lib-settings: Parse block names {} case-insensitively.

dovecot at dovecot.org dovecot at dovecot.org
Sun Feb 24 16:15:35 EET 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/a4f82af20821
changeset: 15916:a4f82af20821
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Feb 24 16:15:23 2013 +0200
description:
lib-settings: Parse block names {} case-insensitively.
This fixes namespace { mailbox foo { .. } } settings when they go through
environment and get uppercased.

diffstat:

 src/lib-settings/settings-parser.c |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (27 lines):

diff -r 514b8fc1e278 -r a4f82af20821 src/lib-settings/settings-parser.c
--- a/src/lib-settings/settings-parser.c	Sun Feb 24 16:02:47 2013 +0200
+++ b/src/lib-settings/settings-parser.c	Sun Feb 24 16:15:23 2013 +0200
@@ -209,7 +209,13 @@
 	ctx->set_pool = set_pool;
 	ctx->parser_pool = parser_pool;
 	ctx->flags = flags;
-	hash_table_create(&ctx->links, ctx->parser_pool, 0, str_hash, strcmp);
+	/* use case-insensitive comparisons. this is mainly because settings
+	   may go through environment variables where their keys get
+	   uppercased. of course the alternative would be to not uppercase
+	   environment. probably doesn't make much difference which way is
+	   chosen. */
+	hash_table_create(&ctx->links, ctx->parser_pool, 0,
+			  strcase_hash, strcasecmp);
 
 	ctx->root_count = count;
 	ctx->roots = p_new(ctx->parser_pool, struct setting_link, count);
@@ -1778,7 +1784,7 @@
 	}
 
 	hash_table_create(&new_ctx->links, new_ctx->parser_pool, 0,
-			  str_hash, strcmp);
+			  strcase_hash, strcasecmp);
 
 	iter = hash_table_iterate_init(old_ctx->links);
 	while (hash_table_iterate(iter, old_ctx->links, &key, &value)) {


More information about the dovecot-cvs mailing list