From: Timo Sirainen Date: Thu, 6 Mar 2025 12:19:45 +0000 (+0200) Subject: config: Add CONFIG_KEY_ESCAPE_CHARS macro X-Git-Tag: 2.4.1~56 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2065ddab1ad5f3009e36aeb8fbc3add60eb12d7f;p=thirdparty%2Fdovecot%2Fcore.git config: Add CONFIG_KEY_ESCAPE_CHARS macro --- diff --git a/src/config/doveconf.c b/src/config/doveconf.c index 41b646f87f..6aec1768bf 100644 --- a/src/config/doveconf.c +++ b/src/config/doveconf.c @@ -42,6 +42,9 @@ struct config_dump_human_context { bool list_prefix_sent:1; }; +/* Characters in setting keys which require escaping */ +#define CONFIG_KEY_ESCAPE_CHARS " \"\\#=" + #define LIST_KEY_PREFIX "\001" #define BOOLLIST_ELEM_KEY_PREFIX "\002" @@ -582,7 +585,7 @@ config_dump_human_output(struct config_dump_human_context *ctx, i_assert(value != NULL); if (!hide_key || bool_list_elem || str_list_elem) { key = t_strdup_until(key, value); - if (strpbrk(key, " \"\\#=") == NULL) + if (strpbrk(key, CONFIG_KEY_ESCAPE_CHARS) == NULL) o_stream_nsend_str(output, key); else { o_stream_nsend(output, "\"", 1);