Skip to content

imapserver: LSUB in IMAP4rev1 is not exactly equivalent to LIST (SUBSCRIBED) #739

@foxcpp

Description

@foxcpp

Found this special case with LSUB command while working on making imaptest happy:

From RFC 3501 6.3.9:

A special situation occurs when using LSUB with the % wildcard.
Consider what happens if "foo/bar" (with a hierarchy delimiter of
"/") is subscribed but "foo" is not. A "%" wildcard to LSUB must
return foo, not foo/bar, in the LSUB response, and it MUST be
flagged with the \Noselect attribute.

[...]

Example: C: A002 LSUB "#news." "comp.mail.*"
S: * LSUB () "." #news.comp.mail.mime
S: * LSUB () "." #news.comp.mail.misc
S: A002 OK LSUB completed
C: A003 LSUB "#news." "comp.%"
S: * LSUB (\NoSelect) "." #news.comp.mail
S: A003 OK LSUB completed

Seems like LSUB in IMAP4rev1 works more like LIST (SUBSCRIBED RECURSIVEMATCH) rather than just LIST (SUBSCRIBED).

Since backend has no knowledge of whether LSUB or LIST was used, it may make sense to turn LSUB into LIST (SUBSCRIBED RECURSIVEMATCH) and then convert response into RFC 3501 format (replace CHILDINFO with NoSelect attribute).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions