procmail
[Top] [All Lists]

Re: howto make shure to get the right Received header

2005-07-28 11:07:19
On Thu, Jul 28, 2005 at 05:38:04PM +0000, Matthias Haeker wrote:

in a chaine of several Received: from header fields 
this rules will MATCH on any Received: from  
header not only on the top most who comes from my sendmail

so someone is able to get around this if he 
puts in the message some header i test for 


Matthias,

The list archives cover the topic of finding (a) the top Received
only; (b) the bottom one only; and (c) finding a specifically
numbered one.

Here is a quick recapitulation.  In each case of brackets,
they contain a caret, space, and tab.

A. Top Received:

 :0
 * ^Received:.*\/[^     ].*
 { RCVD_TOP = $MATCH }


B. Bottom Received:

 :0
 * 1 ^1  ^Received:.*\/[^       ].*
 { RCVD_BTM = $MATCH }


C. Specific-numbered Received:

This one is trickier.  I rely on the "Infinity Shuffle,"
which I first posted about a couple of years ago and sometimes
again since then.

Suppose we want the third-from-the-top.  That's what the "3" will
be about below.


 MAXINT = 2147483647    # see 'man procmailsc'; search for 'infinity'

 :0
 *         -3 ^0
 *  $ $MAXINT ^0
 *          1 ^1  ^Received:.*\/[^      ].*
 #
 # Stop here if there weren't three Receiveds
 * $ -$MAXINT ^0
 { RCVD3 = $MATCH }



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