Mercurial > dovecot > core-2.2
changeset 22409:4445150874d9
config: Log a warning about plugin { ...=no } probably being treated as "yes"
This is properly fixed in v2.3. This should be good enough for now.
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Thu, 10 Aug 2017 10:23:32 +0300 |
parents | a55322dacd7d |
children | e3ba9312f75b |
files | src/config/config-parser-private.h src/config/config-parser.c src/config/old-set-parser.c |
diffstat | 3 files changed, 23 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/config/config-parser-private.h Tue Aug 08 11:25:10 2017 +0300 +++ b/src/config/config-parser-private.h Thu Aug 10 10:23:32 2017 +0300 @@ -9,6 +9,7 @@ CONFIG_LINE_TYPE_CONTINUE, CONFIG_LINE_TYPE_ERROR, CONFIG_LINE_TYPE_KEYVALUE, + CONFIG_LINE_TYPE_KEYVALUE_QUOTED, CONFIG_LINE_TYPE_KEYFILE, CONFIG_LINE_TYPE_KEYVARIABLE, CONFIG_LINE_TYPE_SECTION_BEGIN,
--- a/src/config/config-parser.c Tue Aug 08 11:25:10 2017 +0300 +++ b/src/config/config-parser.c Thu Aug 10 10:23:32 2017 +0300 @@ -679,10 +679,12 @@ ((*line == '"' && line[len-1] == '"') || (*line == '\'' && line[len-1] == '\''))) { line[len-1] = '\0'; - line = str_unescape(line+1); + *value_r = str_unescape(line+1); + return CONFIG_LINE_TYPE_KEYVALUE_QUOTED; + } else { + *value_r = line; + return CONFIG_LINE_TYPE_KEYVALUE; } - *value_r = line; - return CONFIG_LINE_TYPE_KEYVALUE; } if (strcmp(key, "}") == 0 && *line == '\0') @@ -807,6 +809,7 @@ switch (type) { case CONFIG_LINE_TYPE_KEYVALUE: + case CONFIG_LINE_TYPE_KEYVALUE_QUOTED: str_append(str, value); break; case CONFIG_LINE_TYPE_KEYFILE: @@ -868,10 +871,22 @@ } static void -config_parser_check_warnings(struct config_parser_context *ctx, const char *key) +config_parser_check_warnings(struct config_parser_context *ctx, + enum config_line_type type, + const char *key, const char *value) { const char *path, *first_pos; + if (strncmp(str_c(ctx->str), "plugin/", 7) == 0 && + strcasecmp(value, "no") == 0 && + type == CONFIG_LINE_TYPE_KEYVALUE) { + i_warning("%s line %u: plugin { %s=%s } is most likely handled as 'yes' - " + "remove the setting completely to disable it. " + "If this is intentional, add quotes around the value: %s=\"%s\"", + ctx->cur_input->path, ctx->cur_input->linenum, + key, value, key, value); + } + first_pos = hash_table_lookup(ctx->seen_settings, str_c(ctx->str)); if (ctx->cur_section->prev == NULL) { /* changing a root setting. if we've already seen it inside @@ -908,10 +923,11 @@ ctx->error = p_strdup(ctx->pool, value); break; case CONFIG_LINE_TYPE_KEYVALUE: + case CONFIG_LINE_TYPE_KEYVALUE_QUOTED: case CONFIG_LINE_TYPE_KEYFILE: case CONFIG_LINE_TYPE_KEYVARIABLE: str_append(ctx->str, key); - config_parser_check_warnings(ctx, key); + config_parser_check_warnings(ctx, type, key, value); str_append_c(ctx->str, '='); if (config_write_value(ctx, type, key, value) < 0)
--- a/src/config/old-set-parser.c Tue Aug 08 11:25:10 2017 +0300 +++ b/src/config/old-set-parser.c Thu Aug 10 10:23:32 2017 +0300 @@ -587,6 +587,7 @@ case CONFIG_LINE_TYPE_KEYVARIABLE: break; case CONFIG_LINE_TYPE_KEYVALUE: + case CONFIG_LINE_TYPE_KEYVALUE_QUOTED: if (ctx->pathlen == 0) { struct config_section_stack *old_section = ctx->cur_section;