dovecot-2.1: quota: Don't crash if shared namespace's owner does...
dovecot at dovecot.org
dovecot at dovecot.org
Fri Jan 4 23:59:55 EET 2013
details: http://hg.dovecot.org/dovecot-2.1/rev/c91d142130be
changeset: 14865:c91d142130be
user: Timo Sirainen <tss at iki.fi>
date: Fri Jan 04 23:59:42 2013 +0200
description:
quota: Don't crash if shared namespace's owner doesn't have quota enabled (but you have).
diffstat:
src/plugins/quota/quota-storage.c | 18 ++++++++++++------
1 files changed, 12 insertions(+), 6 deletions(-)
diffs (50 lines):
diff -r 7be4709aab5e -r c91d142130be src/plugins/quota/quota-storage.c
--- a/src/plugins/quota/quota-storage.c Fri Jan 04 23:24:26 2013 +0200
+++ b/src/plugins/quota/quota-storage.c Fri Jan 04 23:59:42 2013 +0200
@@ -520,6 +520,7 @@
struct quota_mailbox_list *qlist;
struct quota *quota = NULL;
struct quota_root *root;
+ struct mail_user *quota_user;
bool add;
if (QUOTA_USER_CONTEXT(list->ns->user) == NULL)
@@ -528,8 +529,14 @@
/* see if we have a quota explicitly defined for this namespace */
quota = quota_get_mail_user_quota(list->ns->user);
root = quota_find_root_for_ns(quota, list->ns);
- if (root != NULL)
+ if (root != NULL) {
+ /* explicit quota root */
root->ns = list->ns;
+ quota_user = list->ns->user;
+ } else {
+ quota_user = list->ns->owner != NULL ?
+ list->ns->owner : list->ns->user;
+ }
if ((list->ns->flags & NAMESPACE_FLAG_NOQUOTA) != 0)
add = FALSE;
@@ -538,7 +545,9 @@
explicitly defined for it */
add = root != NULL;
} else {
- add = TRUE;
+ /* for shared namespaces add only if the owner has quota
+ enabled */
+ add = QUOTA_USER_CONTEXT(quota_user) != NULL;
}
if (add) {
@@ -550,10 +559,7 @@
v->deinit = quota_mailbox_list_deinit;
MODULE_CONTEXT_SET(list, quota_mailbox_list_module, qlist);
- /* register to owner's quota roots */
- quota = list->ns->owner != NULL ?
- quota_get_mail_user_quota(list->ns->owner) :
- quota_get_mail_user_quota(list->ns->user);
+ quota = quota_get_mail_user_quota(quota_user);
quota_add_user_namespace(quota, list->ns);
}
}
More information about the dovecot-cvs
mailing list