On Tue, 17 Oct 2006, Matthias H?ker wrote:
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"
(1)
* ^Received:.*\/[^$WS].*
{ X_RECEIVED=$MATCH
:0
(2)
* $ MATCH ?? [(]\/$DOTQUAD
{ X_SENDER_IP=$MATCH }
}
X_SENDER_IP will contain the IP
(3)
with Sendmail i have [ and not a (
so
* $ MATCH ?? [(]\/$DOTQUAD
will be for me
* $ MATCH ?? [[]\/$DOTQUAD
I didn't check but I think that 1+2+3=
* $ ^Received:.*[([]\/$DOTQUAD
{ X_SENDER_IP=$MATCH }
Bye,
Udi
____________________________________________________________
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