[...]
> > I wonder if someone could help me with a Python regex question. On
> > the following header, I want to match the very first (from top to
> > bottom) if it contains certain IP. Below is the header and my
> > current 'header' regex (from INCOMING_FILTER):
> >
> > Received: from atlantis.bus.ucf.edu (atlantis.bus.ucf.edu
[132.170.121.25])
> > by us.olimpus.us (8.12.8/8.12.8) with ESMTP id h5QGu3Ow008784
> > (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO)
> > for <[EMAIL PROTECTED]>; Thu, 26 Jun 2003 12:56:04 -0400
> > Received: from trc106021 (dyn125-212.bus.ucf.edu [132.170.125.212])
> > (authenticated bits=0)
> > by atlantis.bus.ucf.edu (8.12.8/8.12.8) with ESMTP id h5QGuSXO007279
> > (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO)
> > for <[EMAIL PROTECTED]>; Thu, 26 Jun 2003 12:56:28 -0400
> >
> >
> > headers 'Received:.*132\.170\.121\.25' accept
> >
> >
> > I only want a match on the first Received, not the second. What is
happening
> > now is that the first is not match, but if the second has the same IP it
will
> > match.
>
> There is no way to tell, within a regular expression, if the first
> Received: field matched or the second.  That is, you can't instruct an
> RE to match on the nth instance of some string.  If the Received:
> fields were the very first fields in the header, then it might be
> possible, with some weird finagling, but often other fields precede
> them, such as Delivered-To: and Return-Path:.

Tim,

I figured how to do it. All I did was the following (to assure an exact [or
almost exact] match):

headers 'Received: from atlantis\.bus\.ucf\.edu \(atlantis\.bus\.ucf\.edu
\[132\.170\.121\.25\]\)' accept

That will match perfectly the first Received: which is what I wanted, so I
could whitelist everyone on my local machine without being afraid to open my
doors to spoofers.

Thanks! And thanks for the tmda-ofmipd reply as well!

Cheers,


-- 
David

_____________________________________________
tmda-users mailing list ([EMAIL PROTECTED])
http://tmda.net/lists/listinfo/tmda-users

Reply via email to