[exim] how exim parses multiple headers into variables

Góra strony
Delete this message
Reply to this message
Autor: Marc Haber
Data:  
Dla: exim-users
Temat: [exim] how exim parses multiple headers into variables
Hi,

I have an interesting behavior of exim on Debian regarding multiply
existing headers - but it also may be something really stupid.

This is my exim:
|Exim version 4.80 #2 built 24-Jul-2014 03:28:02
|Copyright (c) University of Cambridge, 1995 - 2012
|(c) The Exim Maintainers and contributors in ACKNOWLEDGMENTS file, 2007 - 2012
|Berkeley DB: Berkeley DB 5.1.29: (October 25, 2011)
|Support for: crypteq iconv() IPv6 PAM Perl Expand_dlfunc GnuTLS move_frozen_messages Content_Scanning DKIM Old_Demime
|Lookups (built-in): lsearch wildlsearch nwildlsearch iplsearch cdb dbm dbmjz dbmnz dnsdb dsearch ldap ldapdn ldapm mysql nis nis0 passwd pgsql sqlite
|Authenticators: cram_md5 cyrus_sasl dovecot plaintext spa
|Routers: accept dnslookup ipliteral iplookup manualroute queryprogram redirect
|Transports: appendfile/maildir/mailstore/mbx autoreply lmtp pipe smtp
|Fixed never_users: 0
|Size of off_t: 8
|Configuration file is /var/lib/exim4/config.autogenerated

This is the message:
|From: Marc Haber <mh+eximbug201504@???>
|To: Marc Haber <mh+eximbug201504@???>
|Subject: Re: subject
|X-Spam-Score: -4.2
|X-Spam-Score: -4.4
|
|this is the message body

My exim is running with a system filter:
|# Exim Filter
|
|headers add "${if !eq {$h_x-malware-found:}{}\
|              {X-torres-Malware-Found: $h_x-malware-found:\n}{}}\
|             ${if !eq {$h_x-spam-score:}{}\
|              {X-torres-Spam-Score: $h_x-spam-score:\n}{}}\
|             ${if !eq {$h_x-spam-report:}{}\
|              {X-torres-Spam-Report: $h_x-spam-report:\n}{}}\
|             ${if !eq {$h_x-spam-checker-version:}{}\
|              {X-torres-Spam-Checker-Version: $h_x-spam-checker-version:\n}{}}\
|             ${if !eq {$h_x-spam-status:}{}\
|              {X-torres-Spam-Status: $h_x-spam-status:\n}{}}\
|             ${if !eq {$h_x-spam-level:}{}\
|              {X-torres-Spam-Level: $h_x-spam-level:\n}{}}\
|             "

|headers remove X-Malware-Found:X-Spam-Score:X-Spam-Report:X-Spam-Checker-Version:X-Spam-Status:X-Spam-Level
|
|headers add "${if !eq {$acl_m_malware_name}{}\
|              {X-Malware-Found: $acl_m_malware_name\n}{}}\
|             ${if !eq {$acl_m_spam_score}{}\
|              {X-Spam-Score: $acl_m_spam_score\n}{}}\
|             ${if !eq {$acl_m_spam_report}{}\
|              {X-Spam-Report: $acl_m_spam_report\n}{}}\
|            "


And this is what is delivered to my Inbox when I feed the message to
exim on the command line or via SMTP using swaks --data:

|From: Marc Haber <mh+eximbug201504@???>
|Subject: Re: subject
|To: Marc Haber <mh+eximbug201504@???>
|Date: Mon, 27 Apr 2015 19:48:06 +0200
|Return-path: <root@???>
|Envelope-to: mh@???
|Delivery-date: Mon, 27 Apr 2015 19:48:06 +0200
|Received: from root by torres.zugschlus.de with local (Exim 4.80)
| (envelope-from <root@???>) id 1Ymn8Y-0003NJ-R8 for
| mh@???; Mon, 27 Apr 2015 19:48:06 +0200

|Message-Id: <E1Ymn8Y-0003NJ-R8@???>
|X-torres-Spam-Score: -4.2
|
|-4.4
|
|this is the message body

Please notice that the contents of the two X-Spam-Score headers get
folded into a single one, with an empty line between the two
instances, and the second content without a leading space. This makes
other software think that this is the end of the headers, and the rest
of the message is placed in the body.

exim -d+all yields the following:
|19:49:24 13145 condition: !eq {$h_x-spam-score:}{}
|19:49:24 13145    result: true
|19:49:24 13145 expanding: X-torres-Spam-Score: $h_x-spam-score:
|19:49:24 13145
|19:49:24 13145    result: X-torres-Spam-Score: -4.2
|19:49:24 13145 -4.4
|19:49:24 13145


Is this the intended behavior? Is it the result of some
misconfiguration? Is it a (known) bug in Exim? Is there a fix/a
workaround?

Greetings
Marc, who hasnt straced Exim in a decade
-- 
-------------------------------------- !! No courtesy copies, please !! -----
Marc Haber         |   " Questions are the         | Mailadresse im Header
Mannheim, Germany  |     Beginning of Wisdom "     | http://www.zugschlus.de/
Nordisch by Nature | Lt. Worf, TNG "Rightful Heir" | Fon: *49 621 72739834