procmail
[Top] [All Lists]

Re: howto make shure to get the right Received header

2005-07-30 02:16:32
 
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.

i shoud read more in the archive 
sorry for bothering u for basic knowledge about procmail

to make clear i understood now what i was looking for:

A. Top Received:

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



so i changed my recipe
to:

:0
* $ ^Received:.*\/[^$WS].*
{ X_RECEIVED=$MATCH
    :0
     * $ MATCH  ??  [[]\/$DOTQUAD
     { X_SENDER_IP="$MATCH" }
}

will MATCH on the first "Received:"  
containing the pattern .* = anything
and will fill the $MATCH variable
with all it finds from the first non whitespace on

and in the nested recipe on the $DOTQUAD behind the  "["
if any
what is not the case if the email got forwarded local with !target action

and

:0
* $ X_RECEIVED ?? [\(]from[$WS][^$WS]*[\(_at_)]\/localhost
* $ X_SENDER_IP ?? ![^$WS] ## i am not shure if 
                           ## i realy need this condition
                           ## but it is true if email is 
                           ## forwarded local with !target
{ X_IS_LOCAL=$TRUE } 


will MATCH if "localhost", literally not the local ip, is 
behind a @ in the X_RECEIVED and not like:

:0
* $ ^Received:[$WS]*[^$WS]from[$WS]\/[^$WS]*
* $ MATCH ?? [\(_at_)]\/.*[^\)]
* $ MATCH ?? localhost
{ X_IS_LOCAL=$TRUE }

what will MATCH on the first Received: in a chaine of Received:
containing, again literally, "localhost".

and i had to change my black.rc because X_RECEIVED contains the full
Received: header now

from:

:0
* $ X_RECEIVED ?? .*\/($HOST|$X_LOCAL_IP)
{ 
  :0
  * $ X_SENDER_IP ?? !$X_LOCAL_IP
 {  ITS_EVIL=$TRUE  } 
} 

to: 

:0 
* $ X_RECEIVED ?? .*from[$WS]*\/($HOST|$X_LOCAL_IP)
{ 
  :0
  * $ X_SENDER_IP ?? !$X_LOCAL_IP
 {  ITS_EVIL=$TRUE  } 
} 
 

is that correct ?

Matthias
********





____________________________________________________________
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