Duplicate headers, Exim WriteHeader using Sendmail::CreateQf

Jules Field MailScanner at ecs.soton.ac.uk
Wed Sep 9 16:14:53 IST 2009

The key is that there is no "Exim::CreateQf" at all, all the MTAs are 
called "Sendmail" internally (as that's the first one I implemented). 
Depending on what "MTA =" setting you have in MailScanner.conf, it does 
a "require" of the correct Sendmail.pm or Exim.pm (and so on) and 
SMDiskStore.pm or EximDiskStore.pm (and so on).

Remember that the package the function is in has nothing to do with the 
name of the file, but everything to do with the "package" statement at 
the top of the file. Take a look at Exim.pm and EximDiskStore.pm and 
you'll see what I mean.

So depending on the MTA you choose, it just pulls in the correct file 
full of functions that all implement the same basic API, without any of 
the MTA-independent code needing to switch between the MTA-specific code 
at all. To the MTA-independent code, all MTA-specific code looks the 
same. There are just 4 implementations of each function, one for each MTA.

On 09/09/2009 16:07, Chris Audley wrote:
> 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?
> Regards,


Julian Field MEng CITP CEng
Buy the MailScanner book at www.MailScanner.info/store

Need help customising MailScanner?
Contact me!
Need help fixing or optimising your systems?
Contact me!
Need help getting you started solving new requirements from your boss?
Contact me!

PGP footprint: EE81 D763 3DB0 0BFD E1DC 7222 11F6 5947 1415 B654
Follow me at twitter.com/JulesFM and twitter.com/MailScanner

This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

More information about the MailScanner mailing list