procmail
[Top] [All Lists]

Handling out-of-memory/empty-set conditions in procmail

1998-05-26 19:29:32
First, a bit of prelude --

My .procmailrc defines a series of variables in the format:

ALTDNSDOM=`cat $HOME/.procmail/altdnsdom | tr '\012' '|'`

which, when loaded, contain the contents of files (the last 
lines of which files are NOT terminated with a linefeed) made 
up of lists like this one:

ALTDNS\.COM
JDSHEP\.COM
NICMAIL\.COM
GREENFORCE\.COM
TEETHWHITE\.COM
INDEPENDENTPRESS\.COM
SMARTNEWS\.NET
TXDONOFRIO\.COM
PARTNERSNOW\.COM
JTSR-STOCK\.COM
NETINDUSTRIES\.NET
LINK2US\.COM
MLSA3\.COM
MAX2001MLM\.COM
NVMAIL\.COM
NEZTEK\.COM
KINGCARD\.COM
CYBERPRENEUR\.NET
POWER2PEOPLE\.COM
EMAIL-MARKETING\.COM
AHEALTHY\.COM
QUIKMONEY\.COM
TSF-INDUSTRIES\.COM
CENTURYNEW\.COM
THEGLOBALMARKETER\.COM
NETSURFPC\.COM
UNITED-CBE\.ORG
WESTCOASTMEMORY\.COM
MLSA-3\.COM

These lists are matched using:

:0
* $^(From:|Received:).*(@|\.)(${ALTDNSDOM})
something_to_do

and:

:0 B
* $.*(@|\.|tp://)*(${ALTDNSDOM})
something_to_do

... where something_to_do may be a file to place matches
in, or may be a procedure that autocomplains to the upstream
of the matched domain.

This basically works great.  However, some edge conditions 
cause it to fail utterly.

For example, occasionally, a mail bomb will come in and cause 

/usr/local/bin/bash: fork: No more processes

situations.  I presume that this is the result of available 
memory being exhausted.  I had one today that resulted in
a series of 200 of these being placed in my procmail log.
This failure results in the set created by
 
ALTDNSDOM=`cat $HOME/.procmail/altdnsdom | tr '\012' '|'`

being empty, which results in 

:0
* $^(From:|Received:).*(@|\.)(${ALTDNSDOM})

registering a false match on every message.

In the case of those recipes that call autocomplainers, this
is a particularly unpleasant failure mode.

I have three questions.

1)  Is there any way I can disable my .procmailrc temporarily in 
the event of 'fork: No more processes' problems?

2) Is there a way that I can identify "empty set" situations
so that false matches caused by them can be avoided?

2)  Does someone have a real good mailbomb-protection recipe
I can call at the top of the .procmailrc that will handle 
such situations quickly and efficiently, preferably storing 
the messages in a file until I can review them later, so that
they will never get to the more sensitive recipes called later?

Thanks.

--
|We have tried ignorance       |            Tom Betz, Generalist               |
|for a very long time, and     | Want to send me email? First, read this page: |
|it's time we tried education. | <http://www.panix.com/~tbetz/mailterms.shtml> |
|<http://www.pobox.com/~tbetz> | YO! MY EMAIL ADDRESS IS HEAVILY SPAM-ARMORED! |