procmail
[Top] [All Lists]

Re: Need help matching IP address

2006-10-16 23:46:51


qqqq schrieb:
I need to extract the IP address of the connecting node so I can deliver 
without extended tests if 
it matches.  Here is what I have working for Sendmail thanks for help from 
the group:
:0  # in brackets are a caret, a space, and a tab
* ^Received:.*\/[^      ].*
* ? echo $MATCH | fgrep -isf /tmp/relay
Maildir/

  

SPACE   = " "
TAB     = "     "           # that was a literal tab in the quotes
WS      = "$SPACE$TAB"      # whitespace

OCTET   = "([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])"
DOTQUAD = "$OCTET[.]$OCTET[.]$OCTET[.]$OCTET"

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

X_SENDER_IP will contain the IP

with Sendmail i have [ and not a (

so

* $ MATCH  ??  [(]\/$DOTQUAD

will be for me

* $ MATCH  ??  [[]\/$DOTQUAD


I am having a hard time doing this under Qmail.  Can somebody help me?  Here 
is how the received 
line looks:
Received: from unknown (HELO qqqq) (67.190.128.23)
  by MUNGED.com with SMTP; 17 Oct 2006 02:06:33 -000

hope this helps

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

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