]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
doveconf: Write how many default setting changes there have been since configured...
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Sun, 2 Mar 2025 09:39:08 +0000 (11:39 +0200)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Wed, 5 Mar 2025 18:20:36 +0000 (20:20 +0200)
src/config/doveconf.c
src/config/old-set-parser.c
src/config/old-set-parser.h

index 6925cd2ec31e8f13999eb98e8e2987132fe85c00..161a206d3ffec307f0ed4882fbcb5183ceacbe78 100644 (file)
@@ -1239,8 +1239,14 @@ int main(int argc, char *argv[])
                if (*info != '\0')
                        printf("# %s\n", info);
                printf("# Hostname: %s\n", my_hostdomain());
-               if (config_parsed_get_version(config, &version))
+               if (config_parsed_get_version(config, &version)) {
+                       unsigned int count = old_settings_default_changes_count(version);
+                       if (count > 0) {
+                               printf("# %u default setting changes since version %s\n",
+                                      count, version);
+                       }
                        printf("dovecot_config_version = %s\n", version);
+               }
                if (!config_path_specified)
                        check_wrong_config(config_path);
                if (scope == CONFIG_DUMP_SCOPE_ALL_WITHOUT_HIDDEN)
index 0d2255d20afe3e96c601449aa02c936b07ea7f48..4ae8506dc71bf53232645df41be755c4bc715c92 100644 (file)
@@ -93,3 +93,18 @@ bool old_settings_default(const char *dovecot_config_version,
        }
        return FALSE;
 }
+
+unsigned int
+old_settings_default_changes_count(const char *dovecot_config_version)
+{
+       struct settings_history *history = settings_history_get();
+       const struct setting_history_default *def;
+       unsigned int count = 0;
+
+       array_foreach(&history->defaults, def) {
+               if (version_cmp(def->version, dovecot_config_version) <= 0)
+                       break;
+               count++;
+       }
+       return count;
+}
index baeb80ef014729c0c0153c557d101efe09e5d2da..d286f054ffd7b59229cd07b79b64cc5dfcaf385f 100644 (file)
@@ -10,5 +10,7 @@ void old_settings_handle(struct config_parser_context *ctx,
 bool old_settings_default(const char *dovecot_config_version,
                          const char *key, const char *key_with_path,
                          const char **old_default_r);
+unsigned int
+old_settings_default_changes_count(const char *dovecot_config_version);
 
 #endif