FixSubstringBoundaries errors

Radoslav Bodó bodik at cesnet.cz
Wed Dec 5 15:49:18 UTC 2018


Hello,

after the latest upgrade of our server from MailScanner 4 to 5.1.2 we
have identified that FixSubstringBoundaries is not working properly.



Currently:

* the function FixSubstringBoundaries(...) updates the body and headers
in the processed $message structure, but final delivered message
contains original non-updated Conten-Type boundary header

* that renders updated messages unusable on the server/client side. In
some cases the messages are just not properly displayed (roundcube), in
some other cases might be deleted silently on the background by the
client (thunderbird).

* possibly corrupted messages can be identified from the logs by
'Content Checks: Fixed awkward MIME boundary for Cyrus IMAP server'



System affected:

	debian 9.5 stretch
	postfix 3.1.8-0+deb9u1
	mailscanner 5.1.2-2
	perl 5.24.1-3+deb9u4
	libmime-tools-perl 5.508-1



The attachments of this message contains data for reproducing the issue:

* mailboundary1.txt            .. test message to reproduce
* mailboundary1-corrupted.txt  .. resulting message documenting the fail
* sendmail.py 		       .. testing helper

cat /tmp/mailboundary1.txt | /tmp/sendmail.py --sender
s at webmail-test.redacted --to s at webmail-test.redacted --raw





The only workaround I've been able to come up is to disable the feature
in the code by commenting out

https://github.com/MailScanner/v5/blob/master/common/usr/share/MailScanner/perl/MailScanner/SweepContent.pm#L215

for the time being.




I've tried to track down message processing down to

https://github.com/MailScanner/v5/blob/master/common/usr/share/MailScanner/perl/MailScanner/Message.pm#L5348

but since my knowledge of mailscanner and postfix internals are poor
I've got lost in DeliverModifiedBody(...)



Any help or idea would be highly appreciated.

Thank you
bodik
-------------- next part --------------
From: bodik at redacted.cz
To: bodik at redacted.cz
Subject: boundaryfix
Content-Type: MULTIPART/MIXED; BOUNDARY="__2018124.A1000013DF4D.xxx.cz__"

--__2018124.A1000013DF4D.xxx.cz__
Content-Type: MULTIPART/ALTERNATIVE; BOUNDARY="__2018124.A1000013DF4D.xxx.cz___2"

--__2018124.A1000013DF4D.xxx.cz___2
Content-Type: text/plain;
        charset="iso-8859-2"
Content-Transfer-Encoding: quoted-printable

xxx
=A0


--__2018124.A1000013DF4D.xxx.cz___2
Content-Type: text/html;
        charset="iso-8859-2"
Content-Transfer-Encoding: quoted-printable

<html>xxx</html>

--__2018124.A1000013DF4D.xxx.cz___2--



--__2018124.A1000013DF4D.xxx.cz__
Content-Type: image/gif; NAME="logo.gif"
Content-Transfer-Encoding: BASE64
Content-Description: logo.gif
Content-ID: <logo.gif>

R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==

--__2018124.A1000013DF4D.xxx.cz__--
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sendmail.py
Type: text/x-python
Size: 2185 bytes
Desc: not available
URL: <http://lists.mailscanner.info/pipermail/mailscanner/attachments/20181205/3d0eeeb3/attachment.py>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.mailscanner.info/pipermail/mailscanner/attachments/20181205/3d0eeeb3/attachment.sig>


More information about the MailScanner mailing list