From: Timo Sirainen Date: Mon, 26 Aug 2024 08:52:36 +0000 (+0300) Subject: quota: Fix deduplication of alias_for namespaces X-Git-Tag: 2.4.0~399 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=567d25e2942027d0df428f35e16cd41490c06eeb;p=thirdparty%2Fdovecot%2Fcore.git quota: Fix deduplication of alias_for namespaces The pointer checks didn't actually work, because they weren't set at this point yet. --- diff --git a/src/plugins/quota/quota.c b/src/plugins/quota/quota.c index 0702f57698..57f69c5f57 100644 --- a/src/plugins/quota/quota.c +++ b/src/plugins/quota/quota.c @@ -495,12 +495,14 @@ quota_is_duplicate_namespace(struct quota *quota, struct mail_namespace *ns) namespaces = array_get("a->namespaces, &count); for (i = 0; i < count; i++) { - /* 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; + /* Count namespace aliases only once. Don't rely only on + non-empty alias_for, because the alias might have been + explicitly added as the wanted quota namespace. We can't + use ns->alias_for pointer comparisons directly, because they + are set later. */ + if (strcmp(ns->set->alias_for, namespaces[i]->set->name) == 0 || + strcmp(namespaces[i]->set->alias_for, ns->set->name) == 0) + return TRUE; if (path != NULL && mailbox_list_get_root_path(namespaces[i]->list,