[Mimedefang] Filtering File extentions
Jason Englander
jason at englanders.cc
Tue Apr 22 15:20:01 EDT 2003
On Tue, 22 Apr 2003, Link, Pete wrote:
> How can I tell the file extention sub filter to ignore emails from certain
> domains???
<SNIP>
See below. Off the top of my head, untested.
> # This procedure returns true for entities with bad filenames.
> sub filter_bad_filename ($) {
# Don't act on bad filenames if the envelope sender address ends in
# foo.org:
return 0 if $Sender =~ /foo\.org>?$/i;
# Don't act on bad filenames if the relay's FQDN resolves to something
# that ends in ackpthth.net or hithere.net:
return 0 if $RelayHostname =~ /(ackpthth|hithere)\.net>?$/i;
> my($entity) = @_;
> my($bad_exts, $re);
>
> # Bad extensions
> $bad_exts =
> '(ade|adp|app|asd|asf|asx|bas|bat|chm|cmd|com|cpl|crt|dll|exe|fxp|hlp|hta|ht
> o|inf|ini|ins|isp|jse?|lib|lnk|mdb|mde|msc|msi|msp|mst|ocx|pcd|pif|prg|reg|s
> cr|sct|sh|shb|shs|sys|url|vb|vbe|vbs|vcs|vxd|wmd|wms|wmz|wsc|wsf|wsh|\{)';
>
> # Do not allow:
> # - curlies
> # - 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);
> }
--
Jason Englander <jason at englanders.cc>
394F 7E02 C105 7268 777A 3F5A 0AC0 C618 0675 80CA
More information about the MIMEDefang
mailing list