From eafe35b9b0e3fd12bf6e9ccec4b21df8d946280d Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Fri, 26 Mar 2010 23:26:39 +0200 Subject: [PATCH] lib-master: Fixed local host {} specific settings. Based on fix by Julien Moutinho --HG-- branch : HEAD --- src/lib-master/master-service-settings-cache.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/lib-master/master-service-settings-cache.c b/src/lib-master/master-service-settings-cache.c index 05d7d75e07..97570d9339 100644 --- a/src/lib-master/master-service-settings-cache.c +++ b/src/lib-master/master-service-settings-cache.c @@ -114,7 +114,7 @@ cache_find(struct master_service_settings_cache *cache, const struct master_service_settings_input *input, const struct setting_parser_context **parser_r) { - struct settings_entry *entry; + struct settings_entry *entry = NULL; if (!cache->done_initial_lookup) return FALSE; @@ -130,16 +130,18 @@ cache_find(struct master_service_settings_cache *cache, if (cache->service_uses_remote) return FALSE; - if (cache->local_host_hash != NULL && input->local_host != NULL) { - /* see if we have it already in cache */ - entry = hash_table_lookup(cache->local_host_hash, - input->local_host); + /* see if we have it already in cache. if local_host is specified, + don't even try to use local_ip (even though we have it), because + there may be different settings specifically for local_host */ + if (input->local_host != NULL) { + if (cache->local_host_hash != NULL) { + entry = hash_table_lookup(cache->local_host_hash, + input->local_host); + } } else if (cache->local_ip_hash != NULL && input->local_ip.family != 0) { entry = hash_table_lookup(cache->local_ip_hash, &input->local_ip); - } else { - entry = NULL; } if (entry != NULL) { -- 2.47.3