diff options
author | Kevin McCarthy <kevin@8t8.us> | 2021-12-07 14:28:18 -0800 |
---|---|---|
committer | Kevin McCarthy <kevin@8t8.us> | 2021-12-07 14:28:18 -0800 |
commit | cc117960fddcd0193ca148927594e1e368cbd745 (patch) | |
tree | 0efb42002ed273cb3fe27243abd91230a39ca67b /imap | |
parent | 987dde4c6d96b93380e7b157f56b02f147e410f6 (diff) |
Loosen imap_open_mailbox() SELECT response data parsing.
DavMail is putting more than one space between '*' and the EXISTS
count, e.g. '* 5 EXISTS'
Strictly speaking, this is disallowed by RFC3501 (see Section 9, Note
2). However, there is also no good reason for imap_open_mailbox() to
be stricter than the untagged handler, which correctly extracts the
count.
Add a check to make sure we are looking at an untagged response, and
then use imap_next_word() rather than just incrementing by two.
Thank you to Michael Gernoth (@stargo) for debugging this issue,
creating a merge request with a possible fix, and helping to test this
commit.
Diffstat (limited to 'imap')
-rw-r--r-- | imap/imap.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/imap/imap.c b/imap/imap.c index ee846f37..e8149371 100644 --- a/imap/imap.c +++ b/imap/imap.c @@ -869,7 +869,9 @@ static int imap_open_mailbox (CONTEXT* ctx) if ((rc = imap_cmd_step (idata)) != IMAP_CMD_CONTINUE) break; - pc = idata->buf + 2; + if (ascii_strncmp (idata->buf, "* ", 2)) + continue; + pc = imap_next_word (idata->buf); /* Obtain list of available flags here, may be overridden by a * PERMANENTFLAGS tag in the OK response */ |