Hi there,
RFC 5258 (IMAP4 LIST command extensions) defines a ‘RECURSIVEMATCH’ selection option which “forces the server to return information about parent mailboxes that don't match other selection options, but have some submailboxes that do.” (Section 3.5 makes the requirement even clearer.)
However that's not what Dovecot 2.3.7 does. AFAICT no LIST response is returned for mailboxes that don't meet the selection criteria, regardless of whether they have a child that does. The violation is visible when reproducing example #9 from Section 5 [0]:
$ env -i USER=user HOME=/dev/shm/dovecot-test/user PATH=/usr/bin:/bin \
doveadm -c /tmp/dovecot.conf mailbox create foo2 baz2
$ env -i USER=user HOME=/dev/shm/dovecot-test/user PATH=/usr/bin:/bin \
doveadm -c /tmp/dovecot.conf mailbox create -s \
foo2/{bar1,bar2} baz2/{bar2,bar22,bar222} eps2 eps2/mamba qux2/bar2
$ env -i USER=user HOME=/dev/shm/dovecot-test/user PATH=/usr/bin:/bin \
doveadm -c /tmp/dovecot.conf exec imap
S: * PREAUTH [CAPABILITY IMAP4rev1 … LIST-EXTENDED …] Logged in as user
C: D01 LIST "" "*"
S: * LIST (\Noselect \HasChildren) "/" qux2
S: * LIST (\HasNoChildren) "/" qux2/bar2
S: * LIST (\HasChildren) "/" eps2
S: * LIST (\HasNoChildren) "/" eps2/mamba
S: * LIST (\HasChildren) "/" baz2
S: * LIST (\HasNoChildren) "/" baz2/bar222
S: * LIST (\HasNoChildren) "/" baz2/bar22
S: * LIST (\HasNoChildren) "/" baz2/bar2
S: * LIST (\HasChildren) "/" foo2
S: * LIST (\HasNoChildren) "/" foo2/bar2
S: * LIST (\HasNoChildren) "/" foo2/bar1
S: * LIST (\HasNoChildren) "/" INBOX
S: D01 OK List completed (0.006 + 0.000 + 0.005 secs).
C: D02 LIST (SUBSCRIBED) "" "*"
S: * LIST (\Subscribed) "/" foo2/bar1
S: * LIST (\Subscribed) "/" foo2/bar2
S: * LIST (\Subscribed) "/" baz2/bar2
S: * LIST (\Subscribed) "/" baz2/bar22
S: * LIST (\Subscribed) "/" baz2/bar222
S: * LIST (\Subscribed) "/" eps2
S: * LIST (\Subscribed) "/" eps2/mamba
S: * LIST (\Subscribed) "/" qux2/bar2
S: D02 OK List completed (0.001 + 0.000 secs).
A LIST command with ‘RECURSIVEMATCH SUBSCRIBED’ selection options produces an incomplete response:
C: D03 LIST (RECURSIVEMATCH SUBSCRIBED) "" "*"
S: * LIST (\Subscribed) "/" foo2/bar1
S: * LIST (\Subscribed) "/" foo2/bar2
S: * LIST (\Subscribed) "/" baz2/bar2
S: * LIST (\Subscribed) "/" baz2/bar22
S: * LIST (\Subscribed) "/" baz2/bar222
S: * LIST (\Subscribed) "/" eps2 (CHILDINFO ("SUBSCRIBED"))
S: * LIST (\Subscribed) "/" eps2/mamba
S: * LIST (\Subscribed) "/" qux2/bar2
S: D03 OK List completed (0.001 + 0.000 secs).
The following untagged LIST responses for ‘foo2’ and ‘baz2’ are missing. RFC 5258 mandates their inclusion because even though they're not subscribed to themselves, they each have (at least) a subscribed child.
S: * LIST () "/" "foo2" ("CHILDINFO" ("SUBSCRIBED"))
S: * LIST () "/" "baz2" ("CHILDINFO" ("SUBSCRIBED"))
Cheers,
Guilhem.