]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
config: Remove CONFIG_DUMP_FLAG_CHECK_SETTINGS
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Wed, 26 Apr 2023 12:03:25 +0000 (15:03 +0300)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 20 Nov 2023 12:21:56 +0000 (14:21 +0200)
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.

src/config/config-connection.c
src/config/config-request.c
src/config/config-request.h
src/config/doveconf.c

index 9b84facfadbfc0f3cbf530cfef5aae5002358b60..9b0080727bbb722774ddc5c158c7bee3efc44e04 100644 (file)
@@ -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;
index 315ae2f7d5281343da5c1cae5adda2dbc910db95..b52455e42a36247c51335e2e23df28e52a551e1e 100644 (file)
@@ -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;
 }
index 46ba58a0341bbacef5ed7b1020235f09c659e251..90e8d4af23731adddcb1d5532b1fb4fb0c083e6f 100644 (file)
@@ -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,
 };
index 64e435fa87fe2ff41717594ecc0fddfe3d4bde3e..163a868998a7f18a0cac84c4427a7684debda639 100644 (file)
@@ -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, &section_idx);
+               else {
+                       if (config_export_all_parsers(&ctx, &section_idx) < 0)
+                               i_unreached();
+               }
        } else if (setting_name_filters != NULL) {
                ret2 = 0;
                /* ignore settings-check failures in configuration. this allows