Simplifies the next commit.
struct config_dump_full_context {
struct config_parsed *config;
+ const char *dovecot_config_version;
struct ostream *output;
enum config_dump_full_dest dest;
if (dest == CONFIG_DUMP_FULL_DEST_STDOUT) {
export_ctx = config_export_init(
CONFIG_DUMP_SCOPE_SET_AND_DEFAULT_OVERRIDES,
- 0,
+ 0, ctx->dovecot_config_version,
config_dump_full_stdout_callback, &dump_ctx);
} else {
export_ctx = config_export_init(
CONFIG_DUMP_SCOPE_SET_AND_DEFAULT_OVERRIDES,
- 0,
+ 0, ctx->dovecot_config_version,
config_dump_full_callback, &dump_ctx);
}
config_export_set_module_parsers(export_ctx,
const char **import_environment_r)
{
struct config_export_context *export_ctx;
- const char *error;
+ const char *dovecot_config_version, *error;
int fd = -1;
struct dump_context dump_ctx = {
.delayed_output = str_new(default_pool, 256),
};
+ if (!config_parsed_get_version(config, &dovecot_config_version))
+ dovecot_config_version = "";
+
if (dest == CONFIG_DUMP_FULL_DEST_STDOUT) {
export_ctx = config_export_init(
CONFIG_DUMP_SCOPE_SET_AND_DEFAULT_OVERRIDES,
- flags, config_dump_full_stdout_callback,
- &dump_ctx);
+ flags, dovecot_config_version,
+ config_dump_full_stdout_callback, &dump_ctx);
} else {
export_ctx = config_export_init(
CONFIG_DUMP_SCOPE_SET_AND_DEFAULT_OVERRIDES,
- flags, config_dump_full_callback, &dump_ctx);
+ flags, dovecot_config_version,
+ config_dump_full_callback, &dump_ctx);
}
struct config_filter_parser *filter_parser =
config_parsed_get_global_filter_parser(config);
struct config_dump_full_context ctx = {
.config = config,
+ .dovecot_config_version = dovecot_config_version,
.output = output,
.dest = dest,
.filters = config_parsed_get_filter_parsers(config),
string_t *value;
HASH_TABLE(const char *, const char *) keys;
enum config_dump_scope scope;
+ const char *dovecot_config_version;
config_request_callback_t *callback;
void *context;
struct config_export_context *
config_export_init(enum config_dump_scope scope,
enum config_dump_flags flags,
+ const char *dovecot_config_version,
config_request_callback_t *callback, void *context)
{
struct config_export_context *ctx;
ctx->callback = callback;
ctx->context = context;
ctx->scope = scope;
+ ctx->dovecot_config_version = p_strdup(pool, dovecot_config_version);
ctx->value = str_new(pool, 256);
if ((ctx->flags & CONFIG_DUMP_FLAG_DEDUPLICATE_KEYS) != 0)
hash_table_create(&ctx->keys, ctx->pool, 0, str_hash, strcmp);
struct config_export_context *
config_export_init(enum config_dump_scope scope,
enum config_dump_flags flags,
+ const char *dovecot_config_version,
config_request_callback_t *callback, void *context)
ATTR_NULL(1, 5);
-#define config_export_init(scope, flags, callback, context) \
- config_export_init(scope, flags, \
+#define config_export_init(scope, flags, version, callback, context) \
+ config_export_init(scope, flags, version, \
(config_request_callback_t *)callback, \
TRUE ? context : CALLBACK_TYPECHECK(callback, \
void (*)(const struct config_export_setting *, typeof(context))))
{
struct config_dump_human_context *ctx;
enum config_dump_flags flags;
+ const char *dovecot_config_version;
pool_t pool;
+ if (!config_parsed_get_version(config, &dovecot_config_version))
+ dovecot_config_version = "";
+
pool = pool_alloconly_create(MEMPOOL_GROWING"config human strings", 1024*32);
ctx = p_new(pool, struct config_dump_human_context, 1);
ctx->pool = pool;
flags = CONFIG_DUMP_FLAG_DEDUPLICATE_KEYS;
ctx->export_ctx = config_export_init(scope, flags,
+ dovecot_config_version,
config_request_get_strings, ctx);
config_export_set_module_parsers(ctx->export_ctx,
filter_parser->module_parsers);