procmail
[Top] [All Lists]

Re: Procmail is over-matching my expression

2005-02-24 23:42:42
At 20:26 2005-02-24 -0700, Justin Gombos wrote:
Thanks for the help Ruud.  Now I'm back to trying to solve my original
problem.  That is, the following message is being falsely detected as
coming *from* me, when it is really *to* me:

  From someone-else
  To: <disposable(_dot_)address(_dot_)jgombos(_at_)spamgourmet(_dot_)com>

This isn't a real header set. How are we supposed to diagnose your problem when we're being spoonfed false info?

  MAILDIR=./

You really aught to specify this as an absolute path.

  FROM_="(From[ ]|(Old-|X-)?(Resent-)?\
  (From|Reply-To|Sender):)(.*\<)?"

  SG_ACCOUNT = jgombos(_at_)spamgourmet(_dot_)com

You should properly escape the dot.

  SG_ADDRESS = [^.]+[.][^.]+[.]$SG_ACCOUNT

Note that when tacked onto the end of the prior expression (which ends with \<, which is a regexp which will match a NEWLINE, hello?), this can match something on a following line, which is EXACTLY what is happening.

Why exactly are you including a newline in a header-defining regexp? And, while you're at it, why not include the beginning of line anchor within the regexp variable assignment, since the contents of it clearly should be anchored, and that saves you from having to do so outside of the variable?

  :0 :
  *$ ^${FROM_}${SG_ADDRESS}
  from_self

Change the condition line:

*$ ^\/${FROM_}${SG_ADDRESS}

Then re-run a test message and note what the MATCH is defined to.

procmail: Match on "^(From[ ]|(Old-|X-)?(Resent-)?(From|Reply-To|Sender):)(.*\<)?[^(_dot_)]+[(_dot_)][^(_dot_)]+[(_dot_)]jgombos(_at_)spamgourmet(_dot_)com"



The conditional should not be matching, because From_ is followed by
"someone-else".  If I remove the [^.]+[.][^.]+[.] expression from
SG_ADDRESS, it works, but it should also work with that prefix.

it works, as in it doesn't match? No surprise there. The first part of that regexp "[^.]+" will handily match from the beginning of a header line all the way up to the first dot. That'd be the "To: <disposable" part, then you have a dot (why not use "\." ?), some other string not comprised of a dot: "address", another dot, and then your email address string. All of which is on the line following your From_ header...

---
 Sean B. Straw / Professional Software Engineering

 Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
 Please DO NOT carbon me on list replies.  I'll get my copy from the list.


____________________________________________________________
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