NB: this means a bare "X-ACL-Warn:" header is harder to add.
any ACL verb, including &%deny%& (though this is potentially useful only in a
RCPT ACL).
-If the data for the &%add_header%& modifier contains one or more newlines that
+Leading and trailing newlines are removed from
+the data for the &%add_header%& modifier; if it then
+contains one or more newlines that
are not followed by a space or a tab, it is assumed to contain multiple header
lines. Each one is checked for valid syntax; &`X-ACL-Warn:`& is added to the
front of any line that is not a valid header line.
JH/07 Avoid using a waiting database for a single-message-only transport.
Performance patch from Paul Fisher. Bugzilla 1262.
+JH/08 Strip leading/trailing newlines from add_header ACL modifier data.
+ Bugzilla 884.
+
Exim version 4.80
-----------------
uschar *p, *q;
int hlen = Ustrlen(hstring);
-/* An empty string does nothing; otherwise add a final newline if necessary. */
+/* Ignore any leading newlines */
+while (*hstring == '\n') hstring++, hlen--;
+/* An empty string does nothing; ensure exactly one final newline. */
if (hlen <= 0) return;
-if (hstring[hlen-1] != '\n') hstring = string_sprintf("%s\n", hstring);
+if (hstring[--hlen] != '\n') hstring = string_sprintf("%s\n", hstring);
+else while(hstring[--hlen] == '\n') hstring[hlen+1] = '\0';
/* Loop for multiple header lines, taking care about continuations */
begin acl
check_rcpt:
- warn message = data1 data1\ndata2 data2
+ warn message = data1 data1\ndata2 data2\n
+ warn message = \n\ndata3\n\ndata4\n\n
warn message = :after_received:After-Received: some text\n\
:at_start:At-Start: some text\n\
:at_end: At-End: some text
+ warn message = data4
accept
Date: Tue, 2 Mar 1999 09:44:33 +0000
X-ACL-Warn: data1 data1
X-ACL-Warn: data2 data2
+X-ACL-Warn: data3
+X-ACL-Warn:
+X-ACL-Warn: data4
At-End: some text
Testing message