procmail
[Top] [All Lists]

Re: bad message id's

1998-03-18 10:03:15
Michael Helm writes:
procmail: Match on ! "^Message-Id:[   ]*<[^   <>@]+(_at_)[^   <>@]+>[ 
      ]*$"

Here's another one this above rule trapped:

Message-Id: <"OP-MIME expo400:439*"" 
<allanm(_at_)op(_dot_)x400(_dot_)icl(_dot_)co(_dot_)uk>"@MHS>

It looks like the rule doesn't like things like whitespace/\n
inside <>.  In the first case the \n probably tripped it; in
the above case it does not see & special-process the quotes.
<XY(_at_)MHS> should be a legal Message-ID field.

v. era's comments:
Both. The rule doesn't permit quoted whitespace in message-id:s --
whitespace (including line breaks) is permitted, but as far as I can
tell only if inside double quotes. (It's been a while since I last
tried to decipher this part of RFC822, though.)

I believe you are correct, but see below.

Some bnf defs from rfc822.txt:

     optional-field =
                 /  "Message-ID"        ":"   msg-id
                 /  "Resent-Message-ID" ":"   msg-id

     msg-id      =  "<" addr-spec ">"            ; Unique message id

        Note:  In particular, quoting is NOT permitted  within  atoms.
               For  example  when  the local-part of an addr-spec must
               contain a special character, a quoted  string  must  be
               used.  Therefore, a specification such as:
 
                            Full\ Name(_at_)Domain
 
               is not legal and must be specified as:
 
                            "Full Name"@Domain

     addr-spec   =  local-part "@" domain        ; global address
 
     local-part  =  word *("." word)             ; uninterpreted
                                                 ; case-preserved
 
     domain      =  sub-domain *("." sub-domain)
 
     sub-domain  =  domain-ref / domain-literal
 
     domain-literal =  "[" *(dtext / quoted-pair) "]"
     domain-ref  =  atom                         ; symbolic reference

     word        =  atom / quoted-string
     quoted-string = <"> *(qtext/quoted-pair) <">; Regular qtext or
                                                 ;   quoted chars.
     qtext       =  <any CHAR excepting <">,     ; => may be folded
                     "\" & CR, and including
                     linear-white-space>

     dtext       =  <any CHAR excluding "[",     ; => may be folded
                     "]", "\" & CR, & including
                     linear-white-space>
 
     quoted-pair =  "\" CHAR                     ; may quote any char

     atom        =  1*<any CHAR except specials, SPACE and CTLs>

     linear-white-space =  1*([CRLF] LWSP-char)  ; semantics = SPACE
                                                 ; CRLF => folding
     LWSP-char   =  SPACE / HTAB                 ; semantics = SPACE

Ok then -- should I complain about the 1st message id, with
the interpolated \n's, & how can the correct quoting rule
be done?

My imagination fails on the regular expression needed; I think
what I'd do instead is something like
capture the message-id field
translate \" to X
translate ".*" to X
then test the result against the original rule.
Anything better?  Would procmail regexp engine be able to match ".*"
if \n was inside the quotes?

<Prev in Thread] Current Thread [Next in Thread>