procmail
[Top] [All Lists]

Re: matching Received

2006-01-06 16:38:52
On Jan 6, 2006, at 1:13 PM, Gerald V. Livingston II wrote:

An idea popped into my head on that discourse. One of you more astute
procmail gurus correct me if I'm wrong. No specifics here, it will  
have to
be fleshed out by others. I probably have something backward in my
logic but this should be something to work with.

The problem you're pecking at is known in other contexts as, "Finding  
the Handoff Header", and ... it takes a bit of code to do it in  
Procmail.
You have to walk the chain of ALL the Received: headers, looking for  
the first one that specifies a non-local IP address.
The way you walk the chain is you start out with an initial state in  
a variable, and add a block of RegExps to it that matches a Receiver:  
header, and leaves the IP address in the MATCH variable. Then, while  
that matches something, and the IP address is local, you keep adding  
that block of RegExps to the variable until either it no longer  
matches at all (you've reached the end of the Received: headers, it's  
all internal!), or you hit an IP address that is non-local, in which  
case, you assign that IP address to a variable.

There's no other way to do it that has any hope of working in most of  
the cases that typically happen in anything larger than a single  
server site.

I'll see if I can drop the code onto a website somewhere later  
tonight. It's based off a previous exercise called, "Six Pack" by a  
gentleman named Walt Dnes, IIRC....

Ah.
Googling for "walt dnes sixpack mjwise" yields:

        <http://info.ccone.at/INFO/Mail-Archives/procmail/Jul-2005/ 
msg00218.html>

Aloha mai Nai`a!
-- 
"Please have your Internet License             http://kapu.net/~mjwise/
   and Usenet Registration handy..."



____________________________________________________________
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>