From: Timo Sirainen Date: Mon, 24 Apr 2017 14:58:53 +0000 (+0300) Subject: quota: Fix namespace deduplication when mailboxes don't have paths. X-Git-Tag: 2.3.0.rc1~1699 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ecd54d6c65d15c1a518c6754383389acac655ec2;p=thirdparty%2Fdovecot%2Fcore.git 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. --- diff --git a/src/plugins/quota/quota.c b/src/plugins/quota/quota.c index 1cb0f3a28b..f695aad477 100644 --- a/src/plugins/quota/quota.c +++ b/src/plugins/quota/quota.c @@ -533,11 +533,19 @@ quota_is_duplicate_namespace(struct quota *quota, struct mail_namespace *ns) 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 */