dovecot-2.0-sslstream: Previous config change broke master's sta...

dovecot at dovecot.org dovecot at dovecot.org
Sat Feb 13 02:55:44 EET 2010


details:   http://hg.dovecot.org/dovecot-2.0-sslstream/rev/46d08ae1314f
changeset: 10198:46d08ae1314f
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Oct 26 21:53:13 2009 -0400
description:
Previous config change broke master's startup.

diffstat:

4 files changed, 23 insertions(+), 8 deletions(-)
src/config/config-connection.c |    2 +-
src/config/config-request.c    |   15 +++++++++++----
src/config/config-request.h    |    7 ++++++-
src/config/doveconf.c          |    7 +++++--

diffs (117 lines):

diff -r d647b795da6d -r 46d08ae1314f src/config/config-connection.c
--- a/src/config/config-connection.c	Mon Oct 26 21:44:10 2009 -0400
+++ b/src/config/config-connection.c	Mon Oct 26 21:53:13 2009 -0400
@@ -102,7 +102,7 @@ static int config_connection_request(str
 	}
 
 	o_stream_cork(conn->output);
-	if (config_request_handle(&filter, module, CONFIG_DUMP_SCOPE_SET, FALSE,
+	if (config_request_handle(&filter, module, CONFIG_DUMP_SCOPE_SET, 0,
 				  config_request_output, conn->output) < 0) {
 		config_connection_destroy(conn);
 		return -1;
diff -r d647b795da6d -r 46d08ae1314f src/config/config-request.c
--- a/src/config/config-request.c	Mon Oct 26 21:44:10 2009 -0400
+++ b/src/config/config-request.c	Mon Oct 26 21:53:13 2009 -0400
@@ -20,6 +20,8 @@ struct settings_export_context {
 
 	config_request_callback_t *callback;
 	void *context;
+
+	enum config_dump_flags flags;
 };
 
 static bool parsers_are_connected(const struct setting_parser_info *root,
@@ -101,12 +103,16 @@ settings_export(struct settings_export_c
 			dump_default = FALSE;
 			break;
 		}
-		if (*((const char *)change_value) == 0) {
+		if (!parent_unique_deflist ||
+		    (ctx->flags & CONFIG_DUMP_FLAG_HIDE_LIST_DEFAULTS) == 0) {
+			/* .. */
+		} else if (*((const char *)change_value) == 0 &&
+			   def->offset != info->type_offset) {
 			/* this is mainly for service {} blocks. if value
 			   hasn't changed, it's the default. even if
 			   info->defaults has a different value. */
 			default_value = value;
-		} else if (parent_unique_deflist) {
+		} else {
 			/* value is set explicitly, but we don't know the
 			   default here. assume it's not the default. */
 			dump_default = TRUE;
@@ -256,7 +262,7 @@ settings_export(struct settings_export_c
 
 int config_request_handle(const struct config_filter *filter,
 			  const char *module, enum config_dump_scope scope,
-			  bool check_settings,
+			  enum config_dump_flags flags,
 			  config_request_callback_t *callback, void *context)
 {
 	struct config_module_parser *parsers, *parser;
@@ -275,6 +281,7 @@ int config_request_handle(const struct c
 		return -1;
 	}
 
+	ctx.flags = flags;
 	ctx.callback = callback;
 	ctx.context = context;
 	ctx.scope = scope;
@@ -293,7 +300,7 @@ int config_request_handle(const struct c
 				settings_parser_get(parser->parser),
 				settings_parser_get_changes(parser->parser));
 
-		if (check_settings) {
+		if ((flags & CONFIG_DUMP_FLAG_CHECK_SETTINGS) != 0) {
 			settings_parse_var_skip(parser->parser);
 			if (!settings_parser_check(parser->parser, ctx.pool,
 						   &error)) {
diff -r d647b795da6d -r 46d08ae1314f src/config/config-request.h
--- a/src/config/config-request.h	Mon Oct 26 21:44:10 2009 -0400
+++ b/src/config/config-request.h	Mon Oct 26 21:53:13 2009 -0400
@@ -12,6 +12,11 @@ enum config_dump_scope {
 	CONFIG_DUMP_SCOPE_CHANGED
 };
 
+enum config_dump_flags {
+	CONFIG_DUMP_FLAG_CHECK_SETTINGS		= 0x01,
+	CONFIG_DUMP_FLAG_HIDE_LIST_DEFAULTS	= 0x02
+};
+
 enum config_key_type {
 	CONFIG_KEY_NORMAL,
 	CONFIG_KEY_LIST,
@@ -23,7 +28,7 @@ typedef void config_request_callback_t(c
 
 int config_request_handle(const struct config_filter *filter,
 			  const char *module, enum config_dump_scope scope,
-			  bool check_settings,
+			  enum config_dump_flags flags,
 			  config_request_callback_t *callback, void *context);
 
 #endif
diff -r d647b795da6d -r 46d08ae1314f src/config/doveconf.c
--- a/src/config/doveconf.c	Mon Oct 26 21:44:10 2009 -0400
+++ b/src/config/doveconf.c	Mon Oct 26 21:53:13 2009 -0400
@@ -119,7 +119,9 @@ static void config_connection_request_hu
 
 	ctx.pool = pool_alloconly_create("config human strings", 10240);
 	i_array_init(&ctx.strings, 256);
-	if (config_request_handle(filter, module, scope, TRUE,
+	if (config_request_handle(filter, module, scope,
+				  CONFIG_DUMP_FLAG_CHECK_SETTINGS |
+				  CONFIG_DUMP_FLAG_HIDE_LIST_DEFAULTS,
 				  config_request_get_strings, &ctx) < 0)
 		return;
 
@@ -366,7 +368,8 @@ int main(int argc, char *argv[])
 	} else {
 		env_put("DOVECONF_ENV=1");
 		if (config_request_handle(&filter, module,
-					  CONFIG_DUMP_SCOPE_SET, TRUE,
+					  CONFIG_DUMP_SCOPE_SET,
+					  CONFIG_DUMP_FLAG_CHECK_SETTINGS,
 					  config_request_putenv, NULL) < 0)
 			i_fatal("Invalid configuration");
 		execvp(exec_args[0], exec_args);


More information about the dovecot-cvs mailing list