procmail
[Top] [All Lists]

Re: Getting the MATCH

2008-07-22 02:46:54
On Mon, Jul 21, 2008 at 09:59:42PM -0700, Professional Software Engineering 
wrote:

At 23:45 2008-07-21 -0400, Skip wrote:

* ? (echo "$FROM" | $FGREP -i -f $IPBLACKLIST)
| $FORMAIL -A "X-IP-Blacklist: Mail originated from a previous source 
of spam--$MATCH"

Uh, where are you capturing the MATCH ?  You seem to be operation on the  
belief that the fgrep output will be captured. First, the "?" operator at 
the beginning of the condition line there checks the RESULT CODE.  
Second, \/ is the MATCH operator, used in a condition line, like so:

* ^Subject:\/.*

would assign the content of the Subject: line to $MATCH.  This is NOT for 
program output.

IF you were to have anything in $MATCH when your recipe executed, it'd be 
by chance of some prior recipe which had set it (due to correct use of 
the match operator).

grep will not return the string which matched in the pattern file, but  
rather the INPUT STRING, which in your case is one big long blob.  If you 
ran it through sed or a perl script to break it down into individual word 
elements each on its own line, you could get a word match as the output  
from grep.

Good comments, Sean.  One other one is that he is not using any
boundary anchors to the search string.  This will cause false
matches.  For example, what if feldman(_at_)example(_dot_)com were in the
blacklist but he ran dman(_at_)example(_dot_)com through his grep?  It would
match.  He needs the "w" flag with his grep, among other fixes.

Dallman
____________________________________________________________
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

<Prev in Thread] Current Thread [Next in Thread>