enum setting_type type;
bool found = FALSE;
+ /* Couldn't get value for the setting, but we're delaying error
+ handling. Mark all settings parsers containing this key as failed.
+ See config-parser.h for details. */
for (l = ctx->cur_section->parsers; l->root != NULL; l++) {
if (settings_parse_get_value(l->parser, key, &type) != NULL) {
- if (l->error == NULL)
- l->error = ctx->error;
+ if (l->delayed_error == NULL)
+ l->delayed_error = ctx->error;
ctx->error = NULL;
found = TRUE;
}
pool_unref(&tmp_pool);
return -1;
}
- if (p->error == NULL)
- p->error = p_strdup(ctx->pool, error);
+ /* Settings checking failed, but we're delaying the
+ error until the settings struct is used by the
+ client side. See config-parser.h */
+ if (p->delayed_error == NULL)
+ p->delayed_error = p_strdup(ctx->pool, error);
}
}
pool_unref(&tmp_pool);
const struct setting_parser_info *root;
struct setting_parser_context *parser;
void *settings;
- const char *error;
+ /* Set if CONFIG_PARSE_FLAG_DELAY_ERRORS is enabled. The error won't
+ cause an immediate config parsing failure. Instead, the error string
+ is forwarded to the config client process, which errors out only if
+ the settings struct is attempted to be used. This allows for example
+ doveadm to be called non-root and not fail even if it can't access
+ ssl_key file. */
+ const char *delayed_error;
};
ARRAY_DEFINE_TYPE(config_module_parsers, struct config_module_parser *);
const struct config_module_parser *parser = &ctx->parsers[parser_idx];
int ret = 0;
- if (parser->error != NULL) {
- *error_r = parser->error;
+ if (parser->delayed_error != NULL) {
+ *error_r = parser->delayed_error;
return -1;
}