procmail
[Top] [All Lists]

Re: some Received headerfield analysis

2006-07-01 14:04:52
On 7/1/06, Ruud H.G. van Tol <rvtol(_at_)isolution(_dot_)nl> wrote:
Save as received.rc, and run as

  received.rc < /dev/null

This is interesting, but it needs a wrapper to set H_RECV to each
received line in a message in turn, and recursively include the
script.

With appropriate edits to received.rc so as not to re-assign H_RECV,
this seems to do it:

---- 8< ---- snip ---- 8< ----
# nextrcvd.rc
RCVDLINE="Received:.+"
RCVDSEEN="${RCVDSEEN:-}"
:0
* $ ()^$RCVDSEEN\/$RCVDLINE
{
  H_RECV = "$MATCH"
  RCVDSEEN="$RCVDLINE($)$RCVDSEEN"
  INCLUDERC=received.rc
  SWITCHRC=nextrcvd.rc
}
---- 8< ---- snip ---- 8< ----

Here are some samples it might be nice to parse better:

25480   --start--
25480   Received: from gmail-pop.l.google.com [64.233.167.111]  by
localhost with POP3 (fetchmail-6.2.5 polling pop.gmail.com account
xxxxxxxxxxxxxx)         for schaefer(_at_)localhost (single-drop); Fri, 30 Jun
2006 18:06:29 -0700 (PDT)
25480   'gmail-pop.l.google.com' != 'fetchmail-6.2.5'
25480   ipnr: ''
25480   ipnr in hostname-1: 'gmail-pop.l.google.com' []
25480   ipnr in hostname-2: 'fetchmail-6.2.5' []
25480   hex-ipnr in hostname: gmail-pop.l.google.com =[]
25480   --end--

The regex should spot that "by ..." phrase and not expect the stuff in
parens to match the host found in the "from ..." phrase.

25480   --start--
25480   Received: (qmail 42753 invoked from network); 30 Jun 2006 23:21:52 -0000
25480   ipnr: ''
25480   ipnr in hostname-1: '' []
25480   ipnr in hostname-2: '' []
25480   hex-ipnr in hostname:  =[]\
25480   --end--

25480   --start--
25480   Received: (qmail 12587 invoked by alias); 30 Jun 2006 23:21:46 -0000
25480   ipnr: ''
25480   ipnr in hostname-1: '' []
25480   ipnr in hostname-2: '' []
25480   hex-ipnr in hostname:  =[]
25480   --end--

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