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 -e"map{y/a-z/l-za-k/;print}shift" "Jjhi pcdiwtg Ptga wprztg,"

Attachment: 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

Reply via email to