Re: [exim] Date and From header regular expressions (was: Re…

Góra strony
Delete this message
Reply to this message
Autor: Michael Haardt
Data:  
Dla: exim-users
Temat: Re: [exim] Date and From header regular expressions (was: RegEx longer than maximum string length in system filter)
On Fri, Jul 18, 2008 at 10:31:04AM +0200, Schramm, Dominik wrote:
> > There was talk on exim-dev regarding a RFC 2822 date parsing
> > patch to the exim code.
> >
> > http://lists.exim.org/lurker/message/20080604.133713.1e67dcec.en.html
> >
> > I can't find any news regarding this since.
>
> This is slightly off-topic, but why? Is there still only an
> RFC 822 parser? Or does the parser you mention serve a different
> purpose? Does exim parse any Date headers anyway so far?


Up to now, Exim did not parse dates. Its purpose of the new code is,
besides checking syntactical correctness, obtaining the date as time_t.
In the future, I plan to check "Received:" headers, too, and dates are
very important there.

Right now, I have two applications, one extends the header syntax
verification and one offers a new variable, $submission_age.
Unfortunately, Ebay "watched item" mails contain syntactically invalid
dates. I got a positive reply from customer support that the problem
is understood and will be fixed, but no change since a month now.

For an application of the new parser, apply this to the snapshot:

--- src/verify.c.orig   2008-06-06 15:22:26.000000000 +0200
+++ src/verify.c        2008-07-03 14:14:37.000000000 +0200
@@ -1472,6 +1472,24 @@


 for (h = header_list; h != NULL && yield == OK; h = h->next)
   {
+#ifdef EBAY_FIXED_DATE
+  if (h->type == htype_other && header_checkname(h, FALSE) == htype_date)
+    {
+    time_t t;
+    uschar *end;
+
+    colon = Ustrchr(h->text, ':');
+    s = colon + 1;
+    while (isspace(*s)) s++;
+    if ((end=parse_date_time(s,&t)) == NULL || *end)
+      {
+      *msgptr=string_sprintf("invalid date %s",s);
+      return FAIL;
+      }
+    continue;
+    }
+#endif
+
   if (h->type != htype_from &&
       h->type != htype_reply_to &&
       h->type != htype_sender &&


But as I said, don't use this for production yet, until Ebay fixes
their MTA. The code is not well tested yet, either, that's why I
discussed it on exim-dev.

Michael