struct config_export_context *ctx;
struct master_service_settings_output output;
struct config_filter filter;
+ unsigned int section_idx = 0;
const char *path, *value, *error, *module, *const *wanted_modules;
ARRAY(const char *) modules;
ARRAY(const char *) exclude_settings;
o_stream_nsend_str(conn->output, "used-remote\t");
o_stream_nsend_str(conn->output, "\n");
- if (config_export_finish(&ctx) < 0) {
+ if (config_export_finish(&ctx, §ion_idx) < 0) {
config_connection_destroy(conn);
return -1;
}
const struct config_module_parser *parsers;
struct config_module_parser *dup_parsers;
struct master_service_settings_output output;
+ unsigned int section_idx;
bool failed;
};
for (i = 0; i < count; i++) {
if (i > 0)
str_append_c(ctx->value, ' ');
- setting_export_section_name(ctx->value, def, children[i], i);
+ setting_export_section_name(ctx->value, def, children[i],
+ ctx->section_idx + i);
}
change_children = array_get(change_val, &count2);
i_assert(count == count2);
i_assert(count == 0 || children != NULL);
prefix_len = str_len(ctx->prefix);
+ unsigned int section_start_idx = ctx->section_idx;
+ ctx->section_idx += count;
for (i = 0; i < count; i++) {
str_append(ctx->prefix, def->key);
str_append_c(ctx->prefix, SETTINGS_SEPARATOR);
- setting_export_section_name(ctx->prefix, def, children[i], i);
+ setting_export_section_name(ctx->prefix, def, children[i],
+ section_start_idx + i);
str_append_c(ctx->prefix, SETTINGS_SEPARATOR);
settings_export(ctx, def->list_info,
def->type == SET_DEFLIST_UNIQUE,
pool_unref(&ctx->pool);
}
-int config_export_finish(struct config_export_context **_ctx)
+int config_export_finish(struct config_export_context **_ctx,
+ unsigned int *section_idx)
{
struct config_export_context *ctx = *_ctx;
const struct config_module_parser *parser;
return -1;
}
+ ctx->section_idx = *section_idx;
for (i = 0; ctx->parsers[i].root != NULL; i++) {
parser = &ctx->parsers[i];
if (!config_module_want_parser(config_module_parsers,
}
}
}
+ *section_idx = ctx->section_idx;
config_export_free(ctx);
return ret;
}
struct master_service_settings_output *output_r);
const char *
config_export_get_import_environment(struct config_export_context *ctx);
-int config_export_finish(struct config_export_context **ctx);
+int config_export_finish(struct config_export_context **ctx,
+ unsigned int *section_idx);
#endif
unsigned int i, j, count, prefix_count;
unsigned int prefix_idx = UINT_MAX;
size_t len, skip_len, setting_name_filter_len;
+ unsigned int section_idx = 0;
bool unique_key;
int ret = 0;
setting_name_filter_len = setting_name_filter == NULL ? 0 :
strlen(setting_name_filter);
- if (config_export_finish(&ctx->export_ctx) < 0)
+ if (config_export_finish(&ctx->export_ctx, §ion_idx) < 0)
return -1;
array_sort(&ctx->strings, config_string_cmp);
static struct config_dump_human_context *ctx;
const char *str;
size_t len;
+ unsigned int section_idx = 0;
bool dump_section = FALSE;
ctx = config_dump_human_init(NULL, scope, FALSE);
config_export_by_filter(ctx->export_ctx, filter);
- if (config_export_finish(&ctx->export_ctx) < 0)
+ if (config_export_finish(&ctx->export_ctx, §ion_idx) < 0)
return -1;
len = strlen(setting_name_filter);
if (simple_output) {
struct config_export_context *ctx;
+ unsigned int section_idx = 0;
ctx = config_export_init(wanted_modules, NULL, scope,
CONFIG_DUMP_FLAG_CHECK_SETTINGS,
config_request_simple_stdout,
setting_name_filters);
config_export_by_filter(ctx, &filter);
- ret2 = config_export_finish(&ctx);
+ ret2 = config_export_finish(&ctx, §ion_idx);
} else if (setting_name_filters != NULL) {
ret2 = 0;
/* ignore settings-check failures in configuration. this allows
ret2 = config_dump_human(&filter, wanted_modules, scope, NULL, hide_passwords);
} else {
struct config_export_context *ctx;
+ unsigned int section_idx = 0;
ctx = config_export_init(wanted_modules, NULL, CONFIG_DUMP_SCOPE_SET,
CONFIG_DUMP_FLAG_CHECK_SETTINGS,
}
env_put("DOVECONF_ENV", "1");
- if (config_export_finish(&ctx) < 0)
+ if (config_export_finish(&ctx, §ion_idx) < 0)
i_fatal("Invalid configuration");
execvp(exec_args[0], exec_args);
i_fatal("execvp(%s) failed: %m", exec_args[0]);