Hi,
I was able to reproduce the issue with 3.0.5 with these
settings:
unixhierarchysep: yes
altnamespace: no
crossdomains: no
Key factor is unixhierarchysep on. (crossdomains is a
special case. altnamespace on/off only looks different.)
I did a lot of debugging and found out the following:
Compared to version 2.4.x and 2.5.x 3.0.x function
list_data in ../imap/imapd.c does not transform the
hierarchy separator.
In function mboxlist_do_find (../imap/mboxlist.c) below
"Other Users namespace" we have a prefix search. With
"unixhierarchysep on" cyrus uses the wrong prefix
(domainpat) for that search.
Example:
. LIST "" "user/%"
* LIST (\HasChildren) "/" user/bbb
. OK Completed (0.000 secs 4 calls)
. LIST "" "user/bbb/sub01"
. OK Completed (0.000 secs)
In this case cyrus searches with domainpat:
user.bbb/sub01/subsub01
The prefix is previously generated from a variable
called commonpat, which is used only for this specific
search.
So I fixed it there with this patch:
--- cyrus-imapd-3.0.5/imap/mboxlist.c.orig 2018-04-12
13:12:47.633956338 +0200
+++ cyrus-imapd-3.0.5/imap/mboxlist.c 2018-05-30
10:56:44.255724710 +0200
@@ -2774,6 +2774,10 @@
const char *pat = strarray_nth(patterns,
i);
if (pat[prefixlen] != c) break;
}
+ if (rock->namespace->hier_sep == '/') {
+ if (c == '/') c = '.';
+ else if (c == '.') c = DOTCHAR;
+ }
if (i < patterns->count) break;
if (c == '*' || c == '%' || c == '?') break;
commonpat[prefixlen] = c;
Now for the example above the search pattern is
user.bbb.sub01 and the submailbox is returned correctly.
. LIST "" "user/%"
* LIST (\HasChildren) "/" user/bbb
. OK Completed (0.000 secs 4 calls)
. LIST "" "user/bbb/sub01"
* LIST (\HasChildren) "/" user/bbb/sub01
. OK Completed (0.000 secs 2 calls)
. LIST "" "user/bbb/%"
* LIST (\HasChildren) "/" user/bbb/sub01
* LIST (\HasNoChildren) "/" user/bbb/sub.dot01
. OK Completed (0.000 secs 3 calls)
. SUBSCRIBE "user/bbb/sub01"
. OK Completed
. LSUB "" "user/*"
* LSUB () "/" user/bbb/sub01
. OK Completed (0.000 secs 1 calls)
The patch works fine in my test environment and I see no
caveats yet. I would be very nice if someone could check it
:-)
Best regards,
Edda