[2.11.0 PATCH] TNEF conversion: Issue different MIME "name_declared" filename for binary MAPI properties

Thomas Jarosch thomas.jarosch at intra2net.com
Thu Jun 2 17:36:57 CEST 2016

Convert::TNEF will write out the real attachment from the
'AttachData' section. The additional 'Attachment' data structure
contains a binary representation of MAPI properties.

-> Issue a different filename for the MAPI properties so we don't
   run into duplicates if we write custom content
   inspection code based upon name_declared().

Note: We do have to write out the binary MAPI data structure
since it was used to transport viruses in the past.
See the email "Virus in TNEF-encoded attachement not found"
on the amavisd-new mailinglist archive.
 amavisd | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/amavisd b/amavisd
index 7f93194..c865bbd 100755
--- a/amavisd
+++ b/amavisd
@@ -32789,8 +32789,10 @@ sub do_tnef($$) {
       if (defined $dh) {
         my $newpart_obj = Amavis::Unpackers::Part->new("$tempdir/parts",$part);
+        # 'Attachment' contains MAPI properties
+        my $fname_suffix = ($attr_name eq 'Attachment' ? '.mapi_props' : '');
-        $newpart_obj->name_declared([$a->name, $a->longname]);
+        $newpart_obj->name_declared([$a->name.$fname_suffix, $a->longname.$fname_suffix]);
         my $newpart = $newpart_obj->full_name;
         my $outpart = IO::File->new;
         # O_WRONLY etc. can become tainted in Perl5.8.9 [perlbug #62502]

More information about the amavis-users mailing list