dovecot-2.2: lib-master: Fixed caching settings where both local...
dovecot at dovecot.org
dovecot at dovecot.org
Fri Jun 13 12:16:01 UTC 2014
details: http://hg.dovecot.org/dovecot-2.2/rev/1fcaa7d0b35e
changeset: 17488:1fcaa7d0b35e
user: Timo Sirainen <tss at iki.fi>
date: Fri Jun 13 15:13:26 2014 +0300
description:
lib-master: Fixed caching settings where both local_name and local_ip was specified.
Since cache_find() didn't use local_ip for a lookup when local_name existed,
cache_add() shouldn't add both of them either, otherwise it could be
inserting duplicate values to the cache hash and cause crashes.
diffstat:
src/lib-master/master-service-settings-cache.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diffs (32 lines):
diff -r 5416df86b603 -r 1fcaa7d0b35e src/lib-master/master-service-settings-cache.c
--- a/src/lib-master/master-service-settings-cache.c Fri Jun 13 11:35:40 2014 +0300
+++ b/src/lib-master/master-service-settings-cache.c Fri Jun 13 15:13:26 2014 +0300
@@ -167,7 +167,7 @@
if (entry->local_name != NULL)
hash_table_remove(cache->local_name_hash, entry->local_name);
- if (entry->local_ip.family != 0)
+ else if (entry->local_ip.family != 0)
hash_table_remove(cache->local_ip_hash, &entry->local_ip);
settings_parser_deinit(&entry->parser);
}
@@ -239,14 +239,17 @@
hash_table_create(&cache->local_name_hash,
cache->pool, 0, str_hash, strcmp);
}
+ i_assert(hash_table_lookup(cache->local_name_hash,
+ entry_local_name) == NULL);
hash_table_insert(cache->local_name_hash,
entry_local_name, entry);
- }
- if (input->local_ip.family != 0) {
+ } else if (input->local_ip.family != 0) {
if (!hash_table_is_created(cache->local_ip_hash)) {
hash_table_create(&cache->local_ip_hash, cache->pool, 0,
net_ip_hash, net_ip_cmp);
}
+ i_assert(hash_table_lookup(cache->local_ip_hash,
+ &entry->local_ip) == NULL);
hash_table_insert(cache->local_ip_hash,
&entry->local_ip, entry);
}
More information about the dovecot-cvs
mailing list