dovecot-2.2: config: Added hook_config_parser_end for plugins.

dovecot at dovecot.org dovecot at dovecot.org
Sat Jun 13 11:39:16 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/b9601cc46ace
changeset: 18846:b9601cc46ace
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Jun 13 14:36:43 2015 +0300
description:
config: Added hook_config_parser_end for plugins.

diffstat:

 src/config/config-parser-private.h |   2 ++
 src/config/config-parser.c         |  11 +++++++++--
 2 files changed, 11 insertions(+), 2 deletions(-)

diffs (45 lines):

diff -r 0e947c4dbb10 -r b9601cc46ace src/config/config-parser-private.h
--- a/src/config/config-parser-private.h	Fri Jun 12 15:14:52 2015 +0300
+++ b/src/config/config-parser-private.h	Sat Jun 13 14:36:43 2015 +0300
@@ -59,6 +59,8 @@
 };
 
 extern void (*hook_config_parser_begin)(struct config_parser_context *ctx);
+extern int (*hook_config_parser_end)(struct config_parser_context *ctx,
+				     const char **error_r);
 
 int config_apply_line(struct config_parser_context *ctx, const char *key,
 		      const char *line, const char *section_name) ATTR_NULL(4);
diff -r 0e947c4dbb10 -r b9601cc46ace src/config/config-parser.c
--- a/src/config/config-parser.c	Fri Jun 12 15:14:52 2015 +0300
+++ b/src/config/config-parser.c	Sat Jun 13 14:36:43 2015 +0300
@@ -40,6 +40,8 @@
 struct config_filter_context *config_filter;
 struct module *modules;
 void (*hook_config_parser_begin)(struct config_parser_context *ctx);
+int (*hook_config_parser_end)(struct config_parser_context *ctx,
+			      const char **error_r);
 
 static const char *info_type_name_find(const struct setting_parser_info *info)
 {
@@ -697,13 +699,18 @@
 {
 	struct config_filter_context *new_filter;
 	const char *error;
-	int ret;
+	int ret = 0;
+
+	if (hook_config_parser_end != NULL)
+		ret = hook_config_parser_end(ctx, error_r);
 
 	new_filter = config_filter_init(ctx->pool);
 	array_append_zero(&ctx->all_parsers);
 	config_filter_add_all(new_filter, array_idx(&ctx->all_parsers, 0));
 
-	if (ctx->hide_errors)
+	if (ret < 0)
+		;
+	else if (ctx->hide_errors)
 		ret = 0;
 	else if ((ret = config_all_parsers_check(ctx, new_filter, &error)) < 0) {
 		*error_r = t_strdup_printf("Error in configuration file %s: %s",


More information about the dovecot-cvs mailing list