From: Timo Sirainen Date: Wed, 26 Apr 2023 12:03:25 +0000 (+0300) Subject: config: Remove CONFIG_DUMP_FLAG_CHECK_SETTINGS X-Git-Tag: 2.4.0~2106 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e225deabb0284c828a6534bc3b7a8cf8a68f80e6;p=thirdparty%2Fdovecot%2Fcore.git config: Remove CONFIG_DUMP_FLAG_CHECK_SETTINGS The settings are now always checked while parsing the config, and there is no filtering done on config process side. So there is no need to check settings again when exporting settings. --- diff --git a/src/config/config-connection.c b/src/config/config-connection.c index 9b84facfad..9b0080727b 100644 --- a/src/config/config-connection.c +++ b/src/config/config-connection.c @@ -55,7 +55,6 @@ static int config_connection_request(struct config_connection *conn, { const char *import_environment; struct config_filter_context *new_filter; - enum config_dump_flags flags = CONFIG_DUMP_FLAG_CHECK_SETTINGS; while (*args != NULL) { if (strcmp(*args, "reload") == 0) { @@ -80,7 +79,7 @@ static int config_connection_request(struct config_connection *conn, if (global_config_fd == -1) { int fd = config_dump_full(global_config_filter, CONFIG_DUMP_FULL_DEST_RUNDIR, - flags, &import_environment); + 0, &import_environment); if (fd == -1) { o_stream_nsend_str(conn->output, "-Failed\n"); return 0; diff --git a/src/config/config-request.c b/src/config/config-request.c index 315ae2f7d5..b52455e42a 100644 --- a/src/config/config-request.c +++ b/src/config/config-request.c @@ -505,7 +505,6 @@ int config_export_parser(struct config_export_context *ctx, unsigned int *section_idx, const char **error_r) { const struct config_module_parser *parser = &ctx->parsers[parser_idx]; - int ret = 0; if (parser->delayed_error != NULL) { *error_r = parser->delayed_error; @@ -519,11 +518,6 @@ int config_export_parser(struct config_export_context *ctx, settings_parser_get_changes(parser->parser)); } T_END; - if ((ctx->flags & CONFIG_DUMP_FLAG_CHECK_SETTINGS) != 0) { - settings_parse_var_skip(parser->parser); - if (!settings_parser_check(parser->parser, ctx->pool, error_r)) - ret = -1; - } *section_idx = ctx->section_idx; - return ret; + return 0; } diff --git a/src/config/config-request.h b/src/config/config-request.h index 46ba58a034..90e8d4af23 100644 --- a/src/config/config-request.h +++ b/src/config/config-request.h @@ -16,7 +16,6 @@ enum config_dump_scope { }; enum config_dump_flags { - CONFIG_DUMP_FLAG_CHECK_SETTINGS = 0x01, CONFIG_DUMP_FLAG_HIDE_LIST_DEFAULTS = 0x02, CONFIG_DUMP_FLAG_DEDUPLICATE_KEYS = 0x08, }; diff --git a/src/config/doveconf.c b/src/config/doveconf.c index 64e435fa87..163a868998 100644 --- a/src/config/doveconf.c +++ b/src/config/doveconf.c @@ -980,17 +980,14 @@ int main(int argc, char *argv[]) if ((ret == -1 && exec_args != NULL) || ret == 0 || ret == -2) i_fatal("%s", error); - enum config_dump_flags dump_flags = CONFIG_DUMP_FLAG_CHECK_SETTINGS; if (dump_full && exec_args == NULL) { ret2 = config_dump_full(config_filter, CONFIG_DUMP_FULL_DEST_STDOUT, - dump_flags, - &import_environment); + 0, &import_environment); } else if (dump_full) { int temp_fd = config_dump_full(config_filter, CONFIG_DUMP_FULL_DEST_TEMPDIR, - dump_flags, - &import_environment); + 0, &import_environment); if (getenv(DOVECOT_PRESERVE_ENVS_ENV) != NULL) { /* Standalone binary is getting its configuration via doveconf. Clean the environment before calling it. @@ -1010,14 +1007,15 @@ int main(int argc, char *argv[]) struct config_export_context *ctx; unsigned int section_idx = 0; - ctx = config_export_init(scope, - CONFIG_DUMP_FLAG_CHECK_SETTINGS, + ctx = config_export_init(scope, 0, config_request_simple_stdout, setting_name_filters); if ((ret2 = config_export_by_filter(ctx, config_filter, &filter)) < 0) config_export_free(&ctx); - else - ret2 = config_export_all_parsers(&ctx, §ion_idx); + else { + if (config_export_all_parsers(&ctx, §ion_idx) < 0) + i_unreached(); + } } else if (setting_name_filters != NULL) { ret2 = 0; /* ignore settings-check failures in configuration. this allows