]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
doveconf: Fixed a broken "subsection has ssl=yes" warning.
authorTimo Sirainen <tss@iki.fi>
Wed, 20 Apr 2011 15:55:17 +0000 (18:55 +0300)
committerTimo Sirainen <tss@iki.fi>
Wed, 20 Apr 2011 15:55:17 +0000 (18:55 +0300)
src/config/config-parser.c

index 606e843a45dca21d376d98d78ba5ce4bdd7a2234..bc823aa2e2e806c10e085c7ad66783024857cc71 100644 (file)
@@ -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;