External TNEF decoding bug in MailScanner 4.84.3

Georg mailscanner at treibts.org
Thu Dec 1 14:04:00 GMT 2011


Hello,

i had the same problem with tnef and solved it this way:

# diff -sur TNEF.pm.4.84.3 TNEF.pm.working

--- TNEF.pm.4.84.3      2011-08-20 14:32:24.000000000 +0200
+++ TNEF.pm.working     2011-11-30 15:05:40.180563914 +0100
@@ -230,7 +230,7 @@
   # Create the subdir to unpack it into
   #my $unpackdir = "tnef.$$";
   my ($tmpfh, $unpackdir) = tempfile("tnefXXXXXX", TMPDIR => $dir,
UNLINK => 0);
-  $dir =~ s,^.*/,,;
+  $unpackdir =~ s,/,,;
   $unpackdir = $message->MakeNameSafe($unpackdir, $dir);
   unless (mkdir "$dir/$unpackdir", 0777) {
     MailScanner::Log::WarnLog("Trying to unpack %s in message %s, could
not create subdirectory %s, failed to unpack TNEF message", $tnefname,
$message->{id},
@@ -238,6 +238,7 @@
     return 0;
   }
   chmod 0700, "$dir/$unpackdir";
+  chown $owner, $group, "$dir/$unpackdir" if $change;

   my $cmd = MailScanner::Config::Value('tnefexpander') .
             " -f $dir/$tnefname -C $dir/$unpackdir --overwrite";

first line for correct incoming dir temp
second one for clamd accessable

furthermore, i see that incoming/SpamAssassin-Temp woun't be cleaned
after processing TNEFs...


Cheers, georg

> Hi folks,
> 
> The following change to TNEF.pm (from 4.83.5 to 4.84.3) breaks external TNEF decoding:
> 
> 
> @@ -228,7 +228,9 @@
>    my($dir, $tnefname, $message, $perms, $owner, $group, $change) = @_;
> 
>    # Create the subdir to unpack it into
> -  my $unpackdir = "tnef.$$";
> +  #my $unpackdir = "tnef.$$";
> +  my ($tmpfh, $unpackdir) = tempfile("tnefXXXXXX", TMPDIR => $dir, UNLINK => 0);
> +  $dir =~ s,^.*/,,;
>    $unpackdir = $message->MakeNameSafe($unpackdir, $dir);
>    unless (mkdir "$dir/$unpackdir", 0777) {
>      MailScanner::Log::WarnLog("Trying to unpack %s in message %s, could not create subdirectory %s, failed to unpack TNEF message", $tnefname, $message->{id},
> 
> Error logged is:
> 
> Sep 27 15:36:20 mx0 MailScanner[17000]: Expanding TNEF archive at /var/spool/MailScanner/incoming/17000/p8REaJo0023344/winmail.dat
> Sep 27 15:36:20 mx0 MailScanner[17000]: Trying to unpack nwinmail.dat in message p8REaJo0023344, could not create subdirectory p8REaJo0023344//tnefiOXxho, failed to unpack TNEF message
> Sep 27 15:36:20 mx0 MailScanner[17000]: Corrupt TNEF winmail.dat that cannot be analysed in message p8REaJo0023344
> 
> Changing to internal decoder fixes this.
> 
> All worked fine with external decoder in 4.83.5.
> 
> Cheers,
> 
> Phil
> --
> Phil Randal | Infrastructure Engineer
> NHS Herefordshire & Herefordshire Council  | Deputy Chief Executive's Office | I.C.T. Services Division
> Thorn Office Centre, Rotherwas, Hereford, HR2 6JT
> Tel: 01432 260160
> 


More information about the MailScanner mailing list