On Sun, 07 Dec 2003 12:06:30 +0100
Dallman Ross was heard babbling something about Re: GREPing files in procmail
conditions:
On Sun, Dec 07, 2003 at 04:30:05AM +0100, Ralf Hagen wrote:
What I want:
Pseudo-Code:
:0
*^To: {!(grep %mail-recipient% (cut -d: -f 1 /etc/passwd /etc/aliases
|
grep -v '^#'))}
*^X-SPAM-Flag:.*YES
!nobody
Snoopy sleeps in the second line :-(
I don't know what you mean by "Snoopy"; but anyway, going to
www.procmail.org and to the searchable list archive there and
plugging in to the search field
/etc/passwd
gets me pretty quickly to this message (of mine) from last
February, which seems relevant:
http://www.xray.mpe.mpg.de/mailing-lists/procmail/2003-02/msg00408.html
Also, you surely would want your second condition to go first.
Thus, you would not be taking the big performance hit on *every*
message, just those marked as spam.
It also seems that to reduce the performance hit even further you could
relgate the "cut" through two files to a cron job that saved the
results to a SINGLE file containing valid users for procmail to scan
through with grep only. Set the cron job timing based on how frequently
your userbase/aliases file gets added to.
cut -d: -f 1 /etc/passwd /etc/aliases >/etc/validprocusers
Then your recipe only has to grep through /etc/validprocusers.
b) What I plan to do - is this a valid way, or too complicated /
inefficient?
Well, you could run out of LINEBUF space if there are lots of
users in the passwd file.
After saving to a separate file you could probably search through the
archives for some of the ways people WHITELIST addresses using list files
to avoid loading the whole list into a single variable the way Dallman's
suggestion does. That would avoid the LINEBUF problem.
--
Gerald V. Livingston II
Configure your Email to send TEXT ONLY -- See the following page:
http://expita.com/nomime.html
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail