[Mimedefang] How to discard mail silently when it contains bad attachments
-ray
ray at ops.selu.edu
Fri Sep 12 16:50:01 EDT 2003
On Fri, 12 Sep 2003, Ole Holm Nielsen wrote:
> In
> http://lists.roaringpenguin.com/pipermail/mimedefang/2003-August/007540.html
> it is suggested to drop .pif and .scr attachments by this code:
>
> > # drop all pif messages -zrd 8/19/2003
> > $drop_exts = '(pif|scr)';
> > if (re_match($entity, $drop_exts)) {
> > md_graphdefang_log("SLU dropping file $fname from $RelayAddr");
> > return action_discard();
> > }
>
> As I discovered, that code will discard any attachments whose name
> contains the substrings "scr" or "pif". We have dropped the following
> attachments erroneously today: descr.doc, manuscript.doc. Bad, bad !
I noticed that soon after implemented the code. Sorry i forgot i posted
that to the list. I changed it to:
# drop all pif messages -zrd 8/19/2003
$drop_exts = '(pif|scr)';
$drop_re = '\.' . $drop_exts . '\.*([^-A-Za-z0-9_.,]|$)';
if (re_match($entity, $drop_re)) {
md_graphdefang_log("SLU dropping file $fname from $RelayAddr");
return action_discard();
}
Which works a lot better but i found it will also catch things like
somefile.pif.txt, which is probably not the best way either.
ray
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Ray DeJean http://www.r-a-y.org
Systems Engineer Southeastern Louisiana University
IBM Certified Specialist AIX Administration, AIX Support
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
More information about the MIMEDefang
mailing list