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 | |
parent | 97f83c7a669a525a5f5964a5c0708c311673b87f (diff) |
List separator specifiers in router/transport headers_add/remove. Bug 1581
-rw-r--r-- | doc/doc-docbook/spec.xfpt | 20 | ||||
-rw-r--r-- | doc/doc-txt/ChangeLog | 3 | ||||
-rw-r--r-- | src/src/readconf.c | 22 | ||||
-rw-r--r-- | test/confs/0481 | 1 | ||||
-rw-r--r-- | test/scripts/0000-Basic/0481 | 2 |
5 files changed, 32 insertions, 16 deletions
diff --git a/doc/doc-docbook/spec.xfpt b/doc/doc-docbook/spec.xfpt index 3e9cb733a..b5133a201 100644 --- a/doc/doc-docbook/spec.xfpt +++ b/doc/doc-docbook/spec.xfpt @@ -17154,7 +17154,10 @@ and the discussion in chapter &<<CHAPenvironment>>&. .option headers_add routers list&!! unset .cindex "header lines" "adding" .cindex "router" "adding header lines" -This option specifies a list of text headers, newline-separated, +This option specifies a list of text headers, +.new +newline-separated (by default, changeable in the usual way), +.wen that is associated with any addresses that are accepted by the router. Each item is separately expanded, at routing time. However, this option has no effect when an address is just being verified. The way in which @@ -17191,7 +17194,10 @@ avoided. The &%repeat_use%& option of the &%redirect%& router may be of help. .option headers_remove routers list&!! unset .cindex "header lines" "removing" .cindex "router" "removing header lines" -This option specifies a list of text headers, colon-separated, +This option specifies a list of text headers, +.new +colon-separated (by default, changeable in the usual way), +.wen that is associated with any addresses that are accepted by the router. Each item is separately expanded, at routing time. However, this option has no effect when an address is just being verified. The way in which @@ -20238,7 +20244,10 @@ value that the router supplies, and also overriding any value associated with .option headers_add transports list&!! unset .cindex "header lines" "adding in transport" .cindex "transport" "header lines; adding" -This option specifies a list of text headers, newline-separated, +This option specifies a list of text headers, +.new +newline-separated (by default, changeable in the usual way), +.wen which are (separately) expanded and added to the header portion of a message as it is transported, as described in section &<<SECTheadersaddrem>>&. Additional header lines can also be specified by @@ -20263,7 +20272,10 @@ checked, since this option does not automatically suppress them. .option headers_remove transports list&!! unset .cindex "header lines" "removing" .cindex "transport" "header lines; removing" -This option specifies a list of header names, colon-separated; +This option specifies a list of header names, +.new +colon-separated (by default, changeable in the usual way); +.wen these headers are omitted from the message as it is transported, as described in section &<<SECTheadersaddrem>>&. Header removal can also be specified by routers. diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index 5b2155239..7c5c7c87e 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -64,6 +64,9 @@ JH/16 The spamd_address main option now supports a mixed list of local JH/17 Bug 68: The spamd_address main option now supports an optional timeout value per server. +JH/18 Bug 1581: Router and transport options headers_add/remove can + now have the list separator specified. + Exim version 4.85 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 { diff --git a/test/confs/0481 b/test/confs/0481 index b55af8604..926db0f37 100644 --- a/test/confs/0481 +++ b/test/confs/0481 @@ -24,6 +24,7 @@ r2: driver = redirect headers_remove = Remove-Me-Also: headers_remove = Remove-Me: + headers_remove = <; Remove-Me-Too ; Remove-Me-Too2 data = $local_part@domain r3: diff --git a/test/scripts/0000-Basic/0481 b/test/scripts/0000-Basic/0481 index e1b8574db..be89249f3 100644 --- a/test/scripts/0000-Basic/0481 +++ b/test/scripts/0000-Basic/0481 @@ -7,4 +7,6 @@ exim -odi userx Remove-Me: this header is to be removed Another: This is another header Remove-Me-Also: me too! +Remove-Me-Too: me too! +Remove-Me-Too2: me too! **** |