From 2065ddab1ad5f3009e36aeb8fbc3add60eb12d7f Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Thu, 6 Mar 2025 14:19:45 +0200 Subject: [PATCH] config: Add CONFIG_KEY_ESCAPE_CHARS macro --- src/config/doveconf.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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); -- 2.47.3