LIST command should not interpret wildcards in reference

Timo Sirainen tss at iki.fi
Wed Dec 16 13:51:54 UTC 2015


On 14 Dec 2015, at 17:14, Robert Siemer <Robert.Siemer-lists at backsla.sh> wrote:
> 
> Hello everyone,
> 
> I believe this is erroneously implemented in Dovecot:
> 
> 
> >>> for i in c.list_folders('deleteme.*.folder', '%'):
> ...  print(i)
> ...
> ((b'\\HasNoChildren',), b'.', 'deleteme.*.folder')
> ((b'\\HasNoChildren',), b'.', 'deleteme.deleteme.deleteme.folder')
> 
> 
> We see here an interactive python session, which launches
> 
> LIST "deleteme.*.folder" "%"
> 
> over the wire and receives two mailboxes as answer. The response is already parsed, but that’s not important for my point: according to RFC3501 section 6.3.8 LIST Command, the arguments are “reference name” and “mailbox name with possible wildcards”.
> 
> Both arguments are allowed to contain wildcard characters, but they have no special meaning in the reference. Dovecot 2.2.18 doesn’t do that right: the second mailbox should not be listed, because it is not a subfolder of reference.

Well .. I guess ideally Dovecot would behave the way you want it to behave. But this would require API changes and in general it would complicate the listing code that is already too complicated. There are also further reasons why it's not very useful, as mentioned by the 6.3.8 section:

 - Note: The interpretation of the reference argument is implementation-defined.
 - A client SHOULD NOT use such a reference argument except at the explicit request of the user.
 - It doesn't explicitly mention how wildcards should be handled in reference argument.

Also it is not an error for IMAP server to return unsolicited replies as part of any command. So in theory Dovecot could return all the mailboxes as a reply to any LIST command and still be IMAP-standards compliant, although not a very optimal one.

So all in all, I don't think this is something that is going to be changed.



More information about the dovecot mailing list