[Mimedefang] Help with removing files with names defined in bad_exts
Matthew.van.Eerde at hbinc.com
Matthew.van.Eerde at hbinc.com
Tue Aug 10 17:00:51 EDT 2004
David Reta wrote:
> I would like to remove certain named zip files from emails
> but I don't wan't to discard all zip files since we use them.
> I tried to add the whole filename to bad_exts but this does
> not work. Is there somewhere else in the filter I can add
> this or do I need to add my own code to the re_match function.
>
You need to add your own code. Here's a sample (untested)
sub filter_bad_filename ($) {
my($entity) = @_;
my($bad_exts, $re);
my @badfilenames =
( "price.zip",
"the-price.zip",
"snowhite.scr",
)
for my $badfilename (@badfilenames)
{ if (lc $badfilename eq $entity)
{ return 1;
}
}
# Bad extensions
$bad_exts = '(ade|adp|app|asd|asf|asx|bas|bat|chm|cmd|com|cpl|crt|dl
l|exe|fxp|hlp|hta|html?|hto|inf|ini|ins|isp|jse?|lib|lnk|mdb|mde|msc|msi
|msp|mst
|ocx|pcd|pif|prg|reg|scr|sct|sh|shb|shs|sys|url|vb|vbe|vbs|vcs|vxd|wmd|w
ms|wmz|w
sc|wsf|wsh|\{[^\}]+\})';
# Do not allow:
# - CLSIDs {foobarbaz}
# - bad extensions (possibly with trailing dots) at end or
# followed by non-alphanum
$re = '\.' . $bad_exts . '\.*([^-A-Za-z0-9_.,]|$)';
return re_match($entity, $re);
}
Matthew.van.Eerde at hbinc.com 805.964.4554 x902
Hispanic Business Inc./HireDiversity.com Software Engineer
perl -e"map{y/a-z/l-za-k/;print}shift" "Jjhi pcdiwtg Ptga wprztg,"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 2905 bytes
Desc: not available
URL: <https://lists.mimedefang.org/pipermail/mimedefang_lists.mimedefang.org/attachments/20040810/a4551e65/attachment-0003.bin>
More information about the MIMEDefang
mailing list