procmail
[Top] [All Lists]

Re: Check whitelist file and if not there add to whitelist

2005-08-20 13:03:55
On 20 Aug, Tim Rice wrote:
Hello everyone,

I cant figure out why this isn't working. I want to check the existing
whitelist and if the address is already there, add a X-Puremail Tag to the
mail.

Then check to see if it's To: our web forms, not From: us and not already
in the whistlist using the X-Puremail tag.

What is happening is ALL mail is getting the X-puremail tag and added to
the whitelist regardless of the To, From, or X-puremail tag checks.

The problem seems to be in the top recipe but I cant figure out why. Any
help would be appreciated.

:0 
* ?formail -x"From:" -x"Sender:" \ 
  -x"Reply-To:" -x"Return-Path:" \ 
| fgrep -is -f $HOME/whitelist 
{  
         
      :0 hif 
      | formail -A"X-Puremail: Global Whitelist" 
} 

[...]

The fact the "ALL mail is getting the X-puremail tag" sticks out to me.

At first I had a long shot idea. Now it's a longer shot.

I've had a similar problem in the past using egrep -f some_file when
some_file has an unintended blank line in it. In my case, the blank
line was at the end of the file and fgrep does not seem susceptible
to the same problem. However, a couple of quick experiments tell me
that with a blank line at the top or in the middle, or TWO blank lines
at the end, fgrep exhibits the same behavior. My guess is the blank
line matches any newline in the input.

A couple of caveats. There are different grep implementations, so this
could be unique to GNU grep. Also, my software is pretty old, so this
behavior may have changed with more recent versions. That said, the
obvious question is, are there any blank lines in $HOME/whitelist?

Don

-- 
Email address in From: header is valid  * but only for a couple of days *
This is my reluctant response to spammers' unrelenting address harvesting


____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail