Duplicate headers, Exim WriteHeader using Sendmail::CreateQf

Chris Audley chris at navaho.co.uk
Wed Sep 9 16:07:17 IST 2009

We have recently become aware of a problem with duplicate Subject headers
being created in email passing through our MX servers running
mailscanner-4.75.11-1 under CentOS 5.3.

After a bit of digging I think I have tracked the problem down to
WriteHeader in EximDiskStore calling Sendmail::CreateQf instead of
Exim::CreateQf - the Exim and Sendmail transports seem to use different
mechanisms for deleting headers, resulting in deleted headers being added
multiple times in the exim queue files.

Here's what I think is happening:

Subject lines with trailing spaces are marked as unsafe by SweepContent.
This results in ReplaceHeader being called (in DeliverModifiedBody et. al)
 to remove the old subject header and insert the new safed subject text.

ReplaceHeader calls DeleteHeader which under Exim.pm sets a flag saying
the header has been deleted - under Sendmail.pm this actually removes the
header from the metadata array.

When WriteHeader is called in EximDiskStore.pm, this calls
Sendmail::CreateQf which simply joins the meta headers and creates a
string of them all - even the ones marked as deleted.

CreateQf in Exim.pm appears to check for the vanished flag and so would
honour the deleted flag status. Exim CreateQf also does a lot more in
terms of writing out exim specific file headers, so I'm confused as to how
Sendmail CreateQf could be working with exim?

We're going to setup a test server to try WriteHeader with Exim::CreateQf
to check for potential issues, but thought I would ask on here first to
see if what I've written above sounds right and see if there is there a
good reason for WriteHeader in EximDiskStore calling Sendmail::CreateQf?

Chris Audley, Technical Director
Navaho Technologies Ltd.
tel: +44 (0)2380 000010 (ext 110)
mailto:chris at navaho.co.uk

This message has been scanned by the Navaho Mail Service and is believed to be clean.

More information about the MailScanner mailing list