diff options
author | Jeremy Harris <jgh146exb@wizmail.org> | 2015-01-29 19:06:45 +0000 |
---|---|---|
committer | Jeremy Harris <jgh146exb@wizmail.org> | 2015-01-29 19:06:45 +0000 |
commit | 2ad7897851d62bc690844f416d4ca2fabedf9459 (patch) | |
tree | 5420f13216100c8cd9ec529bf0a7998167dc316d /src | |
parent | 97f83c7a669a525a5f5964a5c0708c311673b87f (diff) |
List separator specifiers in router/transport headers_add/remove. Bug 1581
Diffstat (limited to 'src')
-rw-r--r-- | src/src/readconf.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/src/readconf.c b/src/src/readconf.c index 60df37afc..31a4f2da4 100644 --- a/src/src/readconf.c +++ b/src/src/readconf.c @@ -1597,18 +1597,16 @@ switch (type) } else if (ol->type & opt_rep_str) { - uschar sep = Ustrncmp(name, "headers_add", 11)==0 ? '\n' : ':'; - uschar * cp; - - /* Strip trailing whitespace and seperators */ - for (cp = sptr + Ustrlen(sptr) - 1; - cp >= sptr && (*cp == '\n' || *cp == '\t' || *cp == ' ' || *cp == sep); - cp--) *cp = '\0'; - - if (cp >= sptr) - *str_target = string_copy_malloc( - *str_target ? string_sprintf("%s%c%s", *str_target, sep, sptr) - : sptr); + uschar sep_o = Ustrncmp(name, "headers_add", 11)==0 ? '\n' : ':'; + int sep_i = -(int)sep_o; + uschar * list = sptr; + uschar * s; + uschar * list_o = *str_target; + + while ((s = string_nextinlist(&list, &sep_i, NULL, 0))) + list_o = string_append_listele(list_o, sep_o, s); + if (list_o) + *str_target = string_copy_malloc(list_o); } else { |