struct config_filter filter;
const char *path, *error, *module, *const *wanted_modules;
ARRAY(const char *) modules;
+ ARRAY(const char *) exclude_settings;
bool is_master = FALSE;
/* [<args>] */
t_array_init(&modules, 4);
+ t_array_init(&exclude_settings, 4);
i_zero(&filter);
for (; *args != NULL; args++) {
if (str_begins(*args, "service="))
if (strcmp(module, "master") == 0)
is_master = TRUE;
array_push_back(&modules, &module);
+ } else if (str_begins(*args, "exclude=")) {
+ const char *value = *args + 8;
+ array_push_back(&exclude_settings, &value);
} else if (str_begins(*args, "lname="))
filter.local_name = *args + 6;
else if (str_begins(*args, "lip=")) {
array_append_zero(&modules);
wanted_modules = array_count(&modules) == 1 ? NULL :
array_front(&modules);
+ array_append_zero(&exclude_settings);
if (is_master) {
/* master reads configuration only when reloading settings */
o_stream_cork(conn->output);
- ctx = config_export_init(wanted_modules, CONFIG_DUMP_SCOPE_SET, 0,
+ ctx = config_export_init(wanted_modules,
+ array_count(&exclude_settings) == 1 ? NULL :
+ array_front(&exclude_settings),
+ CONFIG_DUMP_SCOPE_SET, 0,
config_request_output, conn->output);
config_export_by_filter(ctx, &filter);
config_export_get_output(ctx, &output);
void *context;
const char *const *modules;
+ const char *const *exclude_settings;
enum config_dump_flags flags;
const struct config_module_parser *parsers;
struct config_module_parser *dup_parsers;
bool dump, dump_default = FALSE;
for (def = info->defines; def->key != NULL; def++) {
+ if (ctx->exclude_settings != NULL &&
+ str_array_find(ctx->exclude_settings, def->key))
+ continue;
+
value = CONST_PTR_OFFSET(set, def->offset);
default_value = info->defaults == NULL ? NULL :
CONST_PTR_OFFSET(info->defaults, def->offset);
}
struct config_export_context *
-config_export_init(const char *const *modules, enum config_dump_scope scope,
+config_export_init(const char *const *modules,
+ const char *const *exclude_settings,
+ enum config_dump_scope scope,
enum config_dump_flags flags,
config_request_callback_t *callback, void *context)
{
ctx->pool = pool;
ctx->modules = modules == NULL ? NULL : p_strarray_dup(pool, modules);
+ ctx->exclude_settings = exclude_settings == NULL ? NULL :
+ p_strarray_dup(pool, exclude_settings);
ctx->flags = flags;
ctx->callback = callback;
ctx->context = context;
enum setting_type type, bool dump_default,
bool *dump_r) ATTR_NULL(3);
struct config_export_context *
-config_export_init(const char *const *modules, enum config_dump_scope scope,
+config_export_init(const char *const *modules,
+ const char *const *exclude_settings,
+ enum config_dump_scope scope,
enum config_dump_flags flags,
config_request_callback_t *callback, void *context)
ATTR_NULL(1, 5);
flags |= CONFIG_DUMP_FLAG_CHECK_SETTINGS;
if (in_section)
flags |= CONFIG_DUMP_FLAG_IN_SECTION;
- ctx->export_ctx = config_export_init(modules, scope, flags,
+ ctx->export_ctx = config_export_init(modules, NULL, scope, flags,
config_request_get_strings, ctx);
return ctx;
}
if (simple_output) {
struct config_export_context *ctx;
- ctx = config_export_init(wanted_modules, scope,
+ ctx = config_export_init(wanted_modules, NULL, scope,
CONFIG_DUMP_FLAG_CHECK_SETTINGS,
config_request_simple_stdout,
setting_name_filters);
} else {
struct config_export_context *ctx;
- ctx = config_export_init(wanted_modules, CONFIG_DUMP_SCOPE_SET,
+ ctx = config_export_init(wanted_modules, NULL, CONFIG_DUMP_SCOPE_SET,
CONFIG_DUMP_FLAG_CHECK_SETTINGS,
config_request_putenv, NULL);
config_export_by_filter(ctx, &filter);