[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:10:18 EDT 2004
Matthew.van.Eerde wrote:
> 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.
>>
>
Sorry for repeated postings. Now that I've read the mimedefang.pl,
here's a better chunk of code:
sub filter_bad_filename ($) {
my($entity) = @_;
my($bad_exts, $re);
my @badfilepats =
( "^price\.zip$",
"^the-price\.zip$",
"^snowhite.scr$",
);
for my $badfilepat (@badfilepats)
{ if (re_match($entity, $badfilepat))
{ return 1;
}
}
# Bad extensions
$bad_exts =
'(ade|adp|app|asd|asf|asx|bas|bat|chm|cmd|com|cpl|crt|dll|exe|fxp|hlp|ht
a|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|wms|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/1423995d/attachment-0003.bin>
More information about the MIMEDefang
mailing list