[Mimedefang] blocked file types in text file
Mark Coetser
mark at thummb.com
Mon Sep 19 12:32:11 EDT 2005
Hi Ppl
I don't know the first thing about perl so please be patient.
If I wanted to create a text file with all the blocked filetypes, how would
I include that text file in my mimedefang-filter ?
Would I be able to do something like
sub filter_bad_filename ($) {
my($entity) = @_;
my($bad_exts, $re);
# Bad extensions
$bad_exts = '/etc/mail/mimedefang-badexts';
# Do not allow:
# - CLSIDs {foobarbaz}
# - bad extensions (possibly with trailing dots) at end
$re = '\.' . $bad_exts . '\.*$';
return 1 if (re_match($entity, $re));
# Look inside ZIP files
if (re_match($entity, '\.zip$') and
$Features{"Archive::Zip"}) {
my $bh = $entity->bodyhandle();
if (defined($bh)) {
my $path = $bh->path();
if (defined($path)) {
return re_match_in_zip_directory($path, $re);
}
}
}
return 0;
}
####/etc/mail/mimedefang-badexts
ade
adp
app
asd
asf
asx
bas
bat
chm
cmd
com
cpl
crt
dll
exe
fxp
hlp
hta
hto
inf
ini
ins
isp
jse?
lib
lnk
mdb
mde
\{[^\}]+\}
####/etc/mail/mimedefang-badexts
Thank you,
Mark Adrian Coetser
mark at tux-edo.co.za
http://www.tux-edo.co.za, http://www.thummb.com
cel: +27 76 527 8789
tel: +27 11 805 2076
fax: +27 11 805 2330
More information about the MIMEDefang
mailing list