Add warning headers directly.
authorMark Wooding <mdw@distorted.org.uk>
Thu, 16 Jul 2015 20:34:01 +0000 (21:34 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Thu, 16 Jul 2015 20:34:01 +0000 (21:34 +0100)
This means we have to stop renaming them.  But if we don't do this then
we can't test the headers in the spam filter.

base.m4
defs.m4
exchange.m4

diff --git a/base.m4 b/base.m4
index 39e302b..947f52d 100644 (file)
--- a/base.m4
+++ b/base.m4
@@ -160,11 +160,10 @@ mail:
        warn     condition = $acl_c_helo_warning
                !condition = ${if eq{$acl_c_mode}{submission}}
                !hosts = +allnets
-                ADD_HEADER(<:X-CONF_header_token-Warning: \
-                       BADHELO \
-                       Client's HELO doesn't match its IP address.\n\t\
-                       helo-name=$sender_helo_name \
-                       address=$sender_host_address:>)
+                WARNING_HEADER(BADHELO,
+                               <:Client's HELO doesn't match its IP address.\n\t\
+                                 helo-name=$sender_helo_name \
+                                 address=$sender_host_address:>)
 
        ## Always allow the empty sender, so that we can receive bounces.
        accept   senders = :
diff --git a/defs.m4 b/defs.m4
index 30d3fe9..69aa7b7 100644 (file)
--- a/defs.m4
+++ b/defs.m4
@@ -136,6 +136,12 @@ FOREACH(<:\
 m4_define(<:RENAME_HEADERS_REMOVE:>, <:m4_dnl
 CLRSEP<::>FOREACH(<:SEP(:)$:><:1:>, <:$1:>):>)
 
+## WARNING_HEADER(tag, msg)
+##
+## Add a warning header to the current mesage.
+m4_define(<:WARNING_HEADER:>,
+<:add_header = X-CONF_header_token-Warning: $1 $2:>)
+
 ## LOOKUP_DOMAIN(dom, [if-found], [if-not-found])
 ##
 ## Look up DOM in the master domains file.  If it's found, put the
index fe79ce3..b4cb02b 100644 (file)
@@ -52,12 +52,11 @@ mail_client_addr:
                           {${if match_domain {$sender_address_domain} \
                                              {+public} \
                                 {+allnets}{! +allnets}}})}
-                ADD_HEADER(<:X-CONF_header_token-Warning: \
-                       RCLNTLSNDR \
-                       Apparently local sender, but received from remote \
-                       server.\n\t\
-                       sender=$sender_address \
-                       host=$sender_host_address:>)
+                 WARNING_HEADER(RCLNTLSNDR,
+                                <:Apparently local sender, but received from remote \
+                                  server.\n\t\
+                                  sender=$sender_address \
+                                  host=$sender_host_address:>)
 
        ## OK.
        accept
@@ -67,8 +66,7 @@ DIVERT(null)
 ### Rename locally-meaningful headers in mail from outside.
 
 m4_define(<:DISTORTED_HEADERS:>,
-<:X-CONF_header_token-Warning,
-X-CONF_header_token-SpamAssassin-Score,
+<:X-CONF_header_token-SpamAssassin-Score,
 X-CONF_header_token-SpamAssassin-Status:>)
 
 SECTION(acl, data)m4_dnl