Mercurial > dovecot > core-2.2
changeset 15916:a4f82af20821
lib-settings: Parse block names {} case-insensitively.
This fixes namespace { mailbox foo { .. } } settings when they go through
environment and get uppercased.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sun, 24 Feb 2013 16:15:23 +0200 |
parents | 514b8fc1e278 |
children | 5e0c1ecad4a5 |
files | src/lib-settings/settings-parser.c |
diffstat | 1 files changed, 8 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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)) {