[Mimedefang] Help with removing files with names defined in bad_exts
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. Thanks, David ___ Visit http://www.mimedefang.org and http://www.canit.ca MIMEDefang mailing list [EMAIL PROTECTED] http://lists.roaringpenguin.com/mailman/listinfo/mimedefang
RE: [Mimedefang] Help with removing files with names defined in bad_exts
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); } [EMAIL PROTECTED] 805.964.4554 x902 Hispanic Business Inc./HireDiversity.com Software Engineer perl -emap{y/a-z/l-za-k/;print}shift Jjhi pcdiwtg Ptga wprztg, smime.p7s Description: S/MIME cryptographic signature ___ Visit http://www.mimedefang.org and http://www.canit.ca MIMEDefang mailing list [EMAIL PROTECTED] http://lists.roaringpenguin.com/mailman/listinfo/mimedefang
RE: [Mimedefang] Help with removing files with names defined in bad_exts
{if (lc $badfilename eq $entity) Should be {if (lc $badfilename eq lc $entity) smime.p7s Description: S/MIME cryptographic signature ___ Visit http://www.mimedefang.org and http://www.canit.ca MIMEDefang mailing list [EMAIL PROTECTED] http://lists.roaringpenguin.com/mailman/listinfo/mimedefang
RE: [Mimedefang] Help with removing files with names defined in bad_exts
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); } [EMAIL PROTECTED] 805.964.4554 x902 Hispanic Business Inc./HireDiversity.com Software Engineer perl -emap{y/a-z/l-za-k/;print}shift Jjhi pcdiwtg Ptga wprztg, smime.p7s Description: S/MIME cryptographic signature ___ Visit http://www.mimedefang.org and http://www.canit.ca MIMEDefang mailing list [EMAIL PROTECTED] http://lists.roaringpenguin.com/mailman/listinfo/mimedefang