Mercurial > dovecot > core-2.2
changeset 21988:3fcf13556825
quota: Fix namespace deduplication when mailboxes don't have paths.
Nothing requires a mailbox path for quota backends, especially imapc.
Still do namespace deduplication based on alias_for settings.
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Mon, 24 Apr 2017 17:58:53 +0300 |
parents | 5e2118ad2356 |
children | 567fdf009ff5 |
files | src/plugins/quota/quota.c |
diffstat | 1 files changed, 10 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/plugins/quota/quota.c Mon Apr 24 17:10:10 2017 +0300 +++ b/src/plugins/quota/quota.c Mon Apr 24 17:58:53 2017 +0300 @@ -531,11 +531,19 @@ if (!mailbox_list_get_root_path(ns->list, MAILBOX_LIST_PATH_TYPE_MAILBOX, &path)) - return TRUE; + path = NULL; namespaces = array_get("a->namespaces, &count); for (i = 0; i < count; i++) { - if (mailbox_list_get_root_path(namespaces[i]->list, + /* count namespace aliases only once. don't rely only on + alias_for != NULL, because the alias might have been + explicitly added as the wanted quota namespace. */ + if (ns->alias_for == namespaces[i] || + namespaces[i]->alias_for == ns) + continue; + + if (path != NULL && + mailbox_list_get_root_path(namespaces[i]->list, MAILBOX_LIST_PATH_TYPE_MAILBOX, &path2) && strcmp(path, path2) == 0) { /* duplicate path */