procmail
[Top] [All Lists]

Re: Problem checking against a whitelist/blacklist

2001-11-25 11:13:21
On 11/25/01 10:52 AM, Don Hammond sat at the `puter and typed:
Louis LeBlanc is having trouble with this and a similar recipe (long
lines split, hopefully for readability):

| :0Bfhw
| * ? formail -x From:  -x Sender:  -x Reply-To:  -x Return-Path:  \
|     -x To:  | egrep -is -f /home/leblanc/.mutt/whitelist \
|     | formail -Y -f -A "X-Whitelist: keep it
| :0A
| { WHITE=YES }
| 

even though they should apprently match:

| 
| $ egrep -is -f ~/.mutt/whitelist testheader.txt 
| From: Louis LeBlanc <leblanc(_at_)keyslapper(_dot_)org>
| 

Maybe I'm missing something, but you don't have any action here. The
final  part of  your  pipeline, appending  the X-Whitelist:  header,
would seem  to be  the problem.  You're not  passing the  headers to
formail at that point. You're  passing the output from egrep. That's
probably what's  failing, but even  if it didn't you're  not passing
any output from the recipe. You're just slurping the input, checking
success,  and  outputting  nothing.  The first  two  parts  of  your
pipeline  should be  the  condition,  and the  third  should be  the
action.  I  don't have  time  to  try it,  but  I  think you'd  want
something like:

:0fhw * ? formail -x From: -x Sender: -x Reply-To: -x Return-Path: \
-x To: | egrep -is  -f /home/leblanc/.mutt/whitelist | formail -Y -f
-A "X-Whitelist: keep it" :0A { WHITE=YES }

Yes, this is what I thought I had.

I  omitted the  "B" flag  because it  doesn't seem  necessary unless
there's  more to  this than  we can  see. And  you were  missing the
closing double quote on the final formail -A command, but that might
have been a cut  'n paste faux pas. Also, I'm not  sure about the -s
option to  egrep here, but  that's your  call. It also  appears that
grep would be sufficient.

Not worried about the grep/egrep thing - unless someone thinks it's an
efficiency improvement.  But that  quote thing -  that was  just plain
dumb of me.  It was a cut/paste  botch, but from the  original text to
the .proc_precheck file,  not from there to my message.  Meaning I did
have it wrong.

I have  also removed the  'B' flag, because  as you mentioned,  it was
unnecessary. It all seems to work fine now.

Thanks!
Lou
-- 
Louis LeBlanc               leblanc(_at_)keyslapper(_dot_)org
Fully Funded Hobbyist, KeySlapper Extrordinaire :)
http://www.keyslapper.org                     ԿԬ

MATH AND ALCOHOL DON'T MIX!
  Please, don't drink and derive.
  -- Mathematicians
     Against
     Drunk
     Deriving
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail