dovecot-2.2: config: Fixes to previous module change.

dovecot at dovecot.org dovecot at dovecot.org
Thu Sep 20 01:01:31 EEST 2012


details:   http://hg.dovecot.org/dovecot-2.2/rev/a73f4d12289e
changeset: 15091:a73f4d12289e
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Sep 20 01:01:20 2012 +0300
description:
config: Fixes to previous module change.

diffstat:

 src/config/config-connection.c |   7 ++++---
 src/config/config-request.c    |   4 +---
 src/config/doveconf.c          |  15 +++++++--------
 3 files changed, 12 insertions(+), 14 deletions(-)

diffs (106 lines):

diff -r 488c7dde19ad -r a73f4d12289e src/config/config-connection.c
--- a/src/config/config-connection.c	Wed Sep 19 18:07:46 2012 +0300
+++ b/src/config/config-connection.c	Thu Sep 20 01:01:20 2012 +0300
@@ -70,7 +70,7 @@
 	struct config_export_context *ctx;
 	struct master_service_settings_output output;
 	struct config_filter filter;
-	const char *path, *error, *module;
+	const char *path, *error, *module, *const *wanted_modules;
 	ARRAY(const char *) modules;
 	bool is_master = FALSE;
 
@@ -102,6 +102,8 @@
 		}
 	}
 	array_append_zero(&modules);
+	wanted_modules = array_count(&modules) == 1 ? NULL :
+		array_idx(&modules, 0);
 
 	if (is_master) {
 		/* master reads configuration only when reloading settings */
@@ -116,8 +118,7 @@
 
 	o_stream_cork(conn->output);
 
-	ctx = config_export_init(array_idx(&modules, 0),
-				 CONFIG_DUMP_SCOPE_SET, 0,
+	ctx = config_export_init(wanted_modules, CONFIG_DUMP_SCOPE_SET, 0,
 				 config_request_output, conn->output);
 	config_export_by_filter(ctx, &filter);
 	config_export_get_output(ctx, &output);
diff -r 488c7dde19ad -r a73f4d12289e src/config/config-request.c
--- a/src/config/config-request.c	Wed Sep 19 18:07:46 2012 +0300
+++ b/src/config/config-request.c	Thu Sep 20 01:01:20 2012 +0300
@@ -348,13 +348,11 @@
 	struct config_export_context *ctx;
 	pool_t pool;
 
-	i_assert(modules != NULL);
-
 	pool = pool_alloconly_create(MEMPOOL_GROWING"config export", 1024*64);
 	ctx = p_new(pool, struct config_export_context, 1);
 	ctx->pool = pool;
 
-	ctx->modules = p_strarray_dup(pool, modules);
+	ctx->modules = modules == NULL ? NULL : p_strarray_dup(pool, modules);
 	ctx->flags = flags;
 	ctx->callback = callback;
 	ctx->context = context;
diff -r 488c7dde19ad -r a73f4d12289e src/config/doveconf.c
--- a/src/config/doveconf.c	Wed Sep 19 18:07:46 2012 +0300
+++ b/src/config/doveconf.c	Thu Sep 20 01:01:20 2012 +0300
@@ -592,7 +592,7 @@
 	const char *orig_config_path, *config_path, *module;
 	ARRAY(const char *) module_names;
 	struct config_filter filter;
-	const char *error;
+	const char *const *wanted_modules, *error;
 	char **exec_args = NULL, **setting_name_filters = NULL;
 	unsigned int i;
 	int c, ret, ret2;
@@ -654,6 +654,8 @@
 		}
 	}
 	array_append_zero(&module_names);
+	wanted_modules = array_count(&module_names) == 1 ? NULL :
+		array_idx(&module_names, 0);
 
 	config_path = master_service_get_config_path(master_service);
 	/* use strcmp() instead of !=, because dovecot -n always gives us
@@ -678,8 +680,7 @@
 
 	if ((ret = config_parse_file(dump_defaults ? NULL : config_path,
 				     expand_vars,
-				     parse_full_config ? NULL :
-				     array_idx(&module_names, 0),
+				     parse_full_config ? NULL : wanted_modules,
 				     &error)) == 0 &&
 	    access(EXAMPLE_CONFIG_DIR, X_OK) == 0) {
 		i_fatal("%s (copy example configs from "EXAMPLE_CONFIG_DIR"/)",
@@ -692,7 +693,7 @@
 	if (simple_output) {
 		struct config_export_context *ctx;
 
-		ctx = config_export_init(array_idx(&module_names, 0), scope,
+		ctx = config_export_init(wanted_modules, scope,
 					 CONFIG_DUMP_FLAG_CHECK_SETTINGS,
 					 config_request_simple_stdout,
 					 setting_name_filters);
@@ -719,14 +720,12 @@
 		if (!config_path_specified)
 			check_wrong_config(config_path);
 		fflush(stdout);
-		ret2 = config_dump_human(&filter, array_idx(&module_names, 0),
-					 scope, NULL);
+		ret2 = config_dump_human(&filter, wanted_modules, scope, NULL);
 	} else {
 		struct config_export_context *ctx;
 
 		env_put("DOVECONF_ENV=1");
-		ctx = config_export_init(array_idx(&module_names, 0),
-					 CONFIG_DUMP_SCOPE_SET,
+		ctx = config_export_init(wanted_modules, CONFIG_DUMP_SCOPE_SET,
 					 CONFIG_DUMP_FLAG_CHECK_SETTINGS,
 					 config_request_putenv, NULL);
 		config_export_by_filter(ctx, &filter);


More information about the dovecot-cvs mailing list