]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-settings: Allow spaces in "key +=value"
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Wed, 5 Feb 2025 09:50:43 +0000 (11:50 +0200)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Wed, 12 Feb 2025 10:41:01 +0000 (12:41 +0200)
This is useful in configuring userdb_fields { key += value }

src/lib-settings/settings.c

index dde92517015f74b1bc43bec2024c312e3ebcdf26..78582821b2c7a1f28603ca6ce6a130409819c615 100644 (file)
@@ -12,6 +12,8 @@
 #include "settings.h"
 #include "var-expand.h"
 
+#include <ctype.h>
+
 enum set_seen_type {
        /* Setting has not been changed */
        SET_SEEN_NO,
@@ -2704,7 +2706,10 @@ settings_override_fill(struct settings_override *set, pool_t pool,
                if (len > 0 && key[len-1] == '+') {
                        /* key+=value */
                        set->append = TRUE;
-                       key = t_strndup(key, len-1);
+                       len--;
+                       while (len > 0 && i_isspace(key[len-1]))
+                               len--;
+                       key = t_strndup(key, len);
                }
                set->key = set->orig_key = p_strdup(pool, key);
                set->path_element_count = path_element_count(set->key);