dovecot-2.0: config: Give clear error that auth settings aren't ...

dovecot at dovecot.org dovecot at dovecot.org
Tue Jan 4 13:57:35 EET 2011


details:   http://hg.dovecot.org/dovecot-2.0/rev/89f4e4cdbeac
changeset: 12549:89f4e4cdbeac
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Jan 04 13:57:33 2011 +0200
description:
config: Give clear error that auth settings aren't supported inside local/remote blocks.

diffstat:

 src/config/config-parser.c |  17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diffs (34 lines):

diff -r fd9c01323475 -r 89f4e4cdbeac src/config/config-parser.c
--- a/src/config/config-parser.c	Tue Jan 04 13:53:17 2011 +0200
+++ b/src/config/config-parser.c	Tue Jan 04 13:57:33 2011 +0200
@@ -74,6 +74,15 @@
 	i_assert(ret > 0);
 }
 
+static bool
+config_parser_is_in_localremote(struct config_section_stack *section)
+{
+	const struct config_filter *filter = &section->filter;
+
+	return filter->local_name != NULL || filter->local_bits > 0 ||
+		filter->remote_bits > 0;
+}
+
 int config_apply_line(struct config_parser_context *ctx, const char *key,
 		      const char *line, const char *section_name)
 {
@@ -85,6 +94,14 @@
 		ret = settings_parse_line(l->parser, line);
 		if (ret > 0) {
 			found = TRUE;
+			/* FIXME: remove once auth does support these. */
+			if (strcmp(l->root->module_name, "auth") == 0 &&
+			    config_parser_is_in_localremote(ctx->cur_section)) {
+				ctx->error = p_strconcat(ctx->pool,
+					"Auth settings not supported inside local/remote blocks: ",
+					key, NULL);
+				return -1;
+			}
 			if (section_name != NULL)
 				config_add_type(l->parser, line, section_name);
 		} else if (ret < 0) {


More information about the dovecot-cvs mailing list