Ticket #349 (closed Bugs: fixed)

Opened 7 years ago

Last modified 7 years ago

Unable to handle line-breaks in IMAP quoted responses

Reported by: octo Owned by: octo
Priority: critical Milestone: 2.0
Component: LogicMail Version: 2.0.0
Keywords: Cc: adam.wos@…
Blocked By: Blocking:

Description

If there is a line-break (e.g. CRLF) in the middle of a quoted response via IMAP, LogicMail's parser will become confused. More specifically, it seems to cause the first step (checking the socket for a whole-line response) to break the response into two separate lines. This problem has never been seen before, since this case is not valid according to the IMAP protocol spec. Also, normal IMAP servers tend to use literals (not quoted strings) for any text containing line breaks.

The relevant section of the IMAP RFC shows the grammar for a quoted response to be as follows:

quoted          = DQUOTE *QUOTED-CHAR DQUOTE
QUOTED-CHAR     = <any TEXT-CHAR except quoted-specials> /
                  "\" quoted-specials
quoted-specials = DQUOTE / "\"
TEXT-CHAR       = <any CHAR except CR and LF>

Like all things, an exception has been discovered, and that exception is breaking LogicMail. When receiving a message with a line break in the headers, like this:

Subject: Foo bar things stuff
 and more things and stuff

(which is completely valid according to the MIME format spec)

Yahoo's IMAP server does not unwrap the header. Instead, it sticks that line break smack in the middle of its FETCH ENVELOPE response:

* 12 FETCH (ENVELOPE ("Sat, 16 Jul 2011 10:16:31 -0400 (EDT)" "Foo bar things stuff
 and more things and stuff" (( . . .

LogicMail needs a workaround for this case, both in the low-level parser code, and in the code that creates actual message envelope strings for display.

Change History

comment:1 Changed 7 years ago by adam.wos

  • Cc adam.wos@… added

comment:2 Changed 7 years ago by octorian

In [923]:

Added handling for line-breaks in IMAP quotable sections (refs #349)

comment:3 Changed 7 years ago by octorian

  • Status changed from new to closed
  • Resolution set to fixed

In [927]:

Merge of bug fixes from trunk (fixes #351, #238, #352, #349)

comment:4 Changed 7 years ago by octo

  • Status changed from closed to reopened
  • Priority changed from major to critical
  • Resolution fixed deleted

Reopening because I think the fix may have introduced a bug where the line response handler stalls indefinitely on empty quoted items in server responses. This case most commonly happens in NAMESPACE responses. More unit tests need to be written, along with fixes for any further discovered issues, before this ticket can be reclosed. Since this may break released builds, fixing it has top priority.

comment:5 Changed 7 years ago by octorian

In [944]:

Fix for stalling on some complex literal/quoted cases (refs #349)

comment:6 Changed 7 years ago by octorian

  • Status changed from reopened to closed
  • Resolution set to fixed

In [945]:

Fix for stalling on some complex literal/quoted cases (fixes #349)

Note: See TracTickets for help on using tickets.