From: Timo Sirainen Date: Wed, 20 Apr 2011 15:55:17 +0000 (+0300) Subject: doveconf: Fixed a broken "subsection has ssl=yes" warning. X-Git-Tag: 2.0.13~53 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f637b33bb82d56c0546eb08cefcbd7617d885232;p=thirdparty%2Fdovecot%2Fcore.git doveconf: Fixed a broken "subsection has ssl=yes" warning. --- diff --git a/src/config/config-parser.c b/src/config/config-parser.c index 606e843a45..bc823aa2e2 100644 --- a/src/config/config-parser.c +++ b/src/config/config-parser.c @@ -335,7 +335,8 @@ config_filter_parser_check(struct config_parser_context *ctx, } static const char * -get_str_setting(struct config_filter_parser *parser, const char *key) +get_str_setting(struct config_filter_parser *parser, const char *key, + const char *default_value) { struct config_module_parser *module_parser; const char *const *set_value; @@ -345,12 +346,13 @@ get_str_setting(struct config_filter_parser *parser, const char *key) for (; module_parser->parser != NULL; module_parser++) { set_value = settings_parse_get_value(module_parser->parser, key, &set_type); - if (set_value != NULL) { + if (set_value != NULL && + settings_parse_is_changed(module_parser->parser, key)) { i_assert(set_type == SET_STR || set_type == SET_ENUM); return *set_value; } } - i_unreached(); + return default_value; } static int @@ -362,8 +364,7 @@ config_all_parsers_check(struct config_parser_context *ctx, struct config_module_parser *tmp_parsers; struct master_service_settings_output output; unsigned int i, count; - const char *ssl_set; - bool global_no_ssl; + const char *ssl_set, *global_ssl_set; pool_t tmp_pool; bool ssl_warned = FALSE; int ret = 0; @@ -381,8 +382,7 @@ config_all_parsers_check(struct config_parser_context *ctx, i_assert(count > 0 && parsers[count-1] == NULL); count--; - global_no_ssl = strcmp(get_str_setting(parsers[0], "ssl"), "no") == 0; - + global_ssl_set = get_str_setting(parsers[0], "ssl", ""); for (i = 0; i < count && ret == 0; i++) { if (config_filter_parsers_get(new_filter, tmp_pool, "", &parsers[i]->filter, @@ -392,9 +392,9 @@ config_all_parsers_check(struct config_parser_context *ctx, break; } - ssl_set = get_str_setting(parsers[i], "ssl"); - if (strcmp(ssl_set, "no") != 0 && global_no_ssl && - !ssl_warned) { + ssl_set = get_str_setting(parsers[i], "ssl", global_ssl_set); + if (strcmp(ssl_set, "no") != 0 && + strcmp(global_ssl_set, "no") == 0 && !ssl_warned) { i_warning("SSL is disabled because global ssl=no, " "ignoring ssl=%s for subsection", ssl_set); ssl_warned = TRUE;