The LSUB command does not act like LIST when provided with an empty mask argument. LIST responds with the hierarchy delimiter:

        * LIST (\Noselect) "." ""
        OK List completed.

whereas LSUB doesn't return anything useful:

        OK Lsub completed.

RFC 3501 doesn't specify what LSUB should do in this case, but Courier IMAP has LSUB act like LIST. The attached patch modifies imap/cmd-list.c to make Dovecot do the same.


Why do I care about LSUB? I'm using a hack for Apple Mail that replaces its LIST command with LSUB (something like what's described here: http://www.macosxhints.com/article.php? story=20040407062603804), to prevent it from syncing public folders from the Exchange server at the office.

The hack replaces _all_ LISTs with LSUBs, including the LIST "" "" Mail.app sends to discover the hierarchy delimiter. Since dovecot doesn't give it any information in response to LSUB "" "", Mail.app defaults to using "/" as a delimiter, which means that trying to access a subfolder only results in an "Invalid mailbox name" error.

While this isn't really a bug in Dovecot, it's not inconceivable that other people than me could be affected by this problem (macosxhints.com has a substantial readership). It's also tricky to diagnose, especially since the "Invalid mailbox name" message doesn't include the invalid mailbox name, so any bug reports you get are likely to eventually be filed under "crazy [Mac] users".

In fact, while Googling to figure out why Dovecot wasn't working for me, I came across at least one poster to this mailing list who had discovered that Mail.app was using "/" as a delimiter. I can't be sure, but I'm guessing that his problem was related to mine.

Since the patch is tiny and doesn't hurt performance or make Dovecot do anything that contradicts the IMAP RFC, I hope you'll consider adding it to the official distribution.

Attachment: lsub-delimiter.patch
Description: Binary data



Eyvind Bernhardsen

Reply via email to