[Mimedefang] problem with archive-zip-1.12
Marco Berizzi
pupilla at hotmail.com
Mon Jul 19 12:58:00 EDT 2004
I'm using this piece of code from Michal Jankowski:
##----------------------------------------------------------------------
--------
## Check for banned files in ZIP files - may add considerable processing
time
## Requires Archive::Zip to be up to date - base Debian version is
ancient and does
## not have the tempFileName utility
##
#if (-s "./INPUTMSG" < 200*1024) {
# if (lc($ext) =~ /\.zip$/) {
# use Archive::Zip qw(:ERROR_CODES);
# my $path = $entity->bodyhandle->path;
# my $zip = Archive::Zip->new();
# Archive::Zip::setErrorHandler(sub {});
# if ($zip->read($path) == AZ_OK()) {
# md_syslog('debug', "Scanning zip file, Path=$path");
# my $tfname = Archive::Zip::tempFileName('.');
# my @members = $zip->members();
# foreach my $member (@members) {
# my $file = $member->fileName();
# $size = $member->uncompressedSize();
# md_syslog('debug', "Scanning zip entry $file,
size=$size");
# # approx 50Mb siz limit!
# if ($size > 50e6) {
# md_graphdefang_log('Archive member too big ',
$file, $RelayAddr);
# action_notify_administrator("Archive member too big $file - mail
bounced");
# action_bounce("Archive member $file too big");
# #action_discard();
# return;
# }
#
# if ($member->isEncrypted()) {
# md_syslog('debug', "scanning Encrypted ZIP member
$file");
# my ($bad_exts, $re);
# $bad_exts =
'(ade|adp|app|asd|asf|asx|bas|bat|chm|cmd|com|cpl|crt|dll|exe|fxp|hlp|ht
a|hto|inf|ini|ins|isp|jse?|lib|lnk|mdb|mde|msc|msi|msp|mst|ocx|pcd|pif|p
rg|reg|scr|sct|sh|shb|shs|sys|url|vb|vbe|vbs|vcs|vxd|wmd|wms|wmz|wsc|wsf
|wsh|zip|\{[^\}]+\})';
# $re = '\.' . $bad_exts . '\.*([^-A-Za-z0-9_.,]|$)';
# if (lc($file) =~ $re) {
# md_graphdefang_log('Encrypted_badfile', $file,
$RelayAddr);
# action_notify_administrator("A file called
$file was detected in an encrypted ZIP file attached to an incoming
e-mail - bounced.");
# #action_quarantine_entire_message("An encrypted
ZIP attachment conatining $file was removed from this document as
it\nconstituted a security hazard. If you require this document, please
contact\nIT Support to arrange for it to be released.\n");
# action_bounce("Encrypted files of this type not allowed here");
# #action_discard();
# return;
# }
# md_syslog('warning', "Encrypted file $file");
# } else {
# $zip->extractMember($member, $tfname);
# md_syslog('debug', "Scanning ZIP entry $file");
# use File::Scan;
# my $scanner = File::Scan->new;
# my $virus = $scanner->scan($tfname);
# unlink($tfname);
# if ($virus) {
# md_graphdefang_log('virus', $virus,
$RelayAddr);
# action_notify_administrator("Virus $VirusName inside zip
found in mail - rejected");
# action_bounce("Virus $VirusName found in mail - rejected");
# #action_discard();
# return;
# }
# }
# }
# } else {
# # do something with broken .zip files (eg. discard)
# # action_quarantine_entire_message("broken zip");
# md_graphdefang_log('bad_file', 'broken zip', $RelayAddr);
# action_notify_administrator("broken zip named $fname - reject");
# action_bounce("broken zip - reject");
# return;
# }
# }
#}
##----------------------------------------------------------------------
--------
I have upgraded my MD box to Slackware 10 with perl 5.8.4
Archive-Zip is 1.12.
Now MD die with this error:
mimedefang-multiplexor[11226]: Slave 0 stderr: Undefined subroutine
&Archive::Zip::tempFileName called at /etc/mail/mimedefang-filter line
348.
This is line 348:
my $tfname = Archive::Zip::tempFileName('.');
Hints?
More information about the MIMEDefang
mailing list