return TRUE;
}
+static bool
+dovecot_config_version_equals(struct config_parser_context *ctx, const char *value)
+{
+ if (strcmp(ctx->dovecot_config_version, value) == 0)
+ return TRUE;
+ if (strcmp(ctx->dovecot_config_version, CONFIG_VERSION_MAX) == 0 &&
+ strcmp(value, CONFIG_VERSION_GIT) == 0)
+ return TRUE;
+ return FALSE;
+}
+
static bool config_parser_get_version(struct config_parser_context *ctx,
const struct config_line *line)
{
if (strcmp(line->key, "dovecot_config_version") == 0) {
if (ctx->dovecot_config_version == NULL)
;
- else if (strcmp(ctx->dovecot_config_version, line->value) != 0) {
+ else if (!dovecot_config_version_equals(ctx, line->value)) {
ctx->error = "dovecot_config_version value can't be changed once set";
return TRUE;
} else {
else if (!config_version_find(line->value, &error)) {
ctx->error = p_strdup_printf(ctx->pool,
"Invalid dovecot_config_version: %s", error);
+ } else if (strcmp(line->value, CONFIG_VERSION_GIT) == 0) {
+ /* git build - this is the same as the latest version. */
+ ctx->dovecot_config_version = CONFIG_VERSION_MAX;
} else {
ctx->dovecot_config_version = p_strdup(ctx->pool, line->value);
}
#define CONFIG_MODULE_DIR MODULEDIR"/settings"
+#define CONFIG_VERSION_GIT "0.0.0"
+#define CONFIG_VERSION_MAX "9999.9999.9999"
+
#define CONFIG_PARSER_CHANGE_GROUP 1
/* change_counter used for default settings created internally */
#define CONFIG_PARSER_CHANGE_DEFAULTS 2
printf("# %u default setting changes since version %s\n",
count, version);
}
- printf("dovecot_config_version = %s\n", version);
+ if (strcmp(version, CONFIG_VERSION_MAX) != 0)
+ printf("dovecot_config_version = %s\n", version);
+ else {
+ /* GIT version was changed to MAX for easier
+ comparisons internally. However, output it
+ back as the original GIT version. */
+ printf("dovecot_config_version = %s\n",
+ CONFIG_VERSION_GIT);
+ }
}
if (!config_path_specified)
check_wrong_config(config_path);