libsrs2 icon indicating copy to clipboard operation
libsrs2 copied to clipboard

Incorrect handling of quoted-string local-parts

Open flowerysong opened this issue 9 years ago • 1 comments

In addition to the dot-strings that are the most common form, SMTP addresses are allowed to have quoted-strings as the local-part. These local-parts can include many ASCII characters (such as @ and ) that are not allowed in dot-strings. I don't believe this was taken into consideration when SRS was designed, and libsrs2 produces invalid addresses when handed a valid address in this format. Viz.:

  • "a b"@example.org becomes SRS0=zlWL=LW=example.org="a b"@example.com
  • "a@b"@example.org becomes SRS0=GOV3=LW=b"@example.org="[email protected]

The correct solution is probably to ensure that a quoted-string is rewritten into a valid quoted-string, so the first example would be output as "SRS0=zlWL=LW=example.org=a b"@example.com. For best compliance with RFC 5321 the address should be converted to its minimally quoted form before rewriting (removing unnecessary \ escapes and/or converting to a dot-string if possible), but that may be more effort than is warranted for such a niche consideration.

flowerysong avatar Nov 19 '15 09:11 flowerysong

RFC 2821 (published 2001) and RFC 5321 both say:

While the above definition for Local-part is relatively permissive, for maximum interoperability, a host that expects to receive mail SHOULD avoid defining mailboxes where the Local-part requires (or uses) the Quoted-string form

I don't think it's unreasonable to ignore quoted-strings. The few examples I see in my logs are all spam. Are you aware of a single actual email address that requires them?

TobyGoodwin avatar Aug 31 '16 20:08 TobyGoodwin