Mercurial > dovecot > core-2.2
changeset 18846:b9601cc46ace
config: Added hook_config_parser_end for plugins.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sat, 13 Jun 2015 14:36:43 +0300 |
parents | 0e947c4dbb10 |
children | d766dbdf871c |
files | src/config/config-parser-private.h src/config/config-parser.c |
diffstat | 2 files changed, 11 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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);
--- 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",