External TNEF decoding bug in MailScanner 4.84.3

Randal, Phil prandal at herefordshire.gov.uk
Tue Sep 27 17:57:03 IST 2011

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.


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

"Any opinion expressed in this e-mail or any attached files are those of the individual and not necessarily those of Herefordshire Council, Herefordshire Primary Care Trust or 2gether NHS Foundation Trust. You should be aware that Herefordshire Council, Herefordshire Primary Care Trust & 2gether NHS Foundation Trust monitors its email service. This e-mail and any attached files are confidential and intended solely for the use of the addressee. This communication may contain material protected by law from being passed on. If you are not the intended recipient and have received this e-mail in error, you are advised that any use, dissemination, forwarding, printing or copying of this e-mail is strictly prohibited. If you have received this e-mail in error please contact the sender immediately and destroy all copies of it. Please consider the environment before printing this e-mail."
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.mailscanner.info/pipermail/mailscanner/attachments/20110927/3149693c/attachment.html

More information about the MailScanner mailing list