From: guenther+procmail(_at_)gac(_dot_)edu
Dallman Ross <dman(_at_)nomotek(_dot_)com> writes:
...
:0 i # two+ `!' or `$' symbols in headers . . .
* ! ^(Return-Path|Sender):.*list
* -175^0
* 100^1 [$!]
* -100^1 ^Message-ID:.*[$!]
{ do some other things if we're here }
So, I had a piece of mail come in that had two `$' chars in the
Message-ID: header. There were no other `!' or `$' signs in the
headers. The logs, though, showed a total score for this section
of -75, not -175! I don't understand how that could be.
When a regexp is being matched multiple times (such as when scoring),
each search is started where the previous one left off**. That's how all
regexp engines keep from finding the same match over and over again. So,
that last condition will only match against a given Message-Id: header
field once, because it'll start the second search after the dollar sign
or bang.
The solution in this case is to extract the value of the Message-Id:
header and then count the $s and !s in MATCH:
:0
* ! ^(Return-Path|Sender):.*list
* -175^0
* 100^1 [$!]
{
# $= now contains the score for the entire header. Correct
# for the Message-Id: header field. Start with the current
# score and go from there.
:0
* $$=^0
* ^Message-Id:\/.*[$!]
* -100^1 MATCH ?? [$!]
{ }
# $= now contains the corrected score. If it's greater than
# zero still, then do whatever
:0
* $$=^0
{ whatever }
}
Excellent. Thank you, Philip.
I enabled this two days ago. Yesterday I found that I also had false
positives on at least two other headers: "In-Reply-To:" and "References:".
Right now I have the middle part in as:
:0
* $ $=^0
* ^(Message-Id|In-Reply-To|References):\/.*[$!]
* -100^1 MATCH ?? [$!]
{ }
I'm not sure whether I've re-invented my original scoring problem by
doing it this way, though.
--
dman+noacks(_at_)nomotek(_dot_)com avoids a weekly auto-acknowledgment.
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail