dovecot-1.3: quota: Don't crash when modifying non-private names...

dovecot at dovecot.org dovecot at dovecot.org
Tue Apr 7 19:27:10 EEST 2009


details:   http://hg.dovecot.org/dovecot-1.3/rev/792c3eb1e544
changeset: 9033:792c3eb1e544
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Apr 07 12:26:50 2009 -0400
description:
quota: Don't crash when modifying non-private namespaces.

diffstat:

1 file changed, 16 insertions(+), 13 deletions(-)
src/plugins/quota/quota-storage.c |   29 ++++++++++++++++-------------

diffs (54 lines):

diff -r 286ff5114588 -r 792c3eb1e544 src/plugins/quota/quota-storage.c
--- a/src/plugins/quota/quota-storage.c	Mon Apr 06 17:20:20 2009 -0400
+++ b/src/plugins/quota/quota-storage.c	Tue Apr 07 12:26:50 2009 -0400
@@ -511,21 +511,22 @@ void quota_mail_storage_created(struct m
 	union mail_storage_module_context *qstorage;
 	struct quota *quota;
 
+	if (qlist == NULL)
+		return;
+
 	qlist->storage = storage;
 
-	qstorage = p_new(storage->pool, union mail_storage_module_context, 1);
+	qstorage = p_new(storage->pool,
+			 union mail_storage_module_context, 1);
 	qstorage->super = storage->v;
 	storage->v.destroy = quota_storage_destroy;
 	storage->v.mailbox_open = quota_mailbox_open;
 
 	MODULE_CONTEXT_SET_SELF(storage, quota_storage_module, qstorage);
 
-	if (storage->ns->owner != NULL &&
-	    (storage->ns->flags & NAMESPACE_FLAG_INTERNAL) == 0) {
-		/* register to owner's quota roots */
-		quota = quota_get_mail_user_quota(storage->ns->owner);
-		quota_add_user_storage(quota, storage);
-	}
+	/* register to owner's quota roots */
+	quota = quota_get_mail_user_quota(storage->ns->owner);
+	quota_add_user_storage(quota, storage);
 
 	if (quota_next_hook_mail_storage_created != NULL)
 		quota_next_hook_mail_storage_created(storage);
@@ -535,12 +536,14 @@ void quota_mailbox_list_created(struct m
 {
 	struct quota_mailbox_list *qlist;
 
-	qlist = p_new(list->pool, struct quota_mailbox_list, 1);
-	qlist->module_ctx.super = list->v;
-	list->v.delete_mailbox = quota_mailbox_list_delete;
-
-	MODULE_CONTEXT_SET(list, quota_mailbox_list_module, qlist);
-
+	if (list->ns->owner != NULL &&
+	    (list->ns->flags & NAMESPACE_FLAG_INTERNAL) == 0) {
+		qlist = p_new(list->pool, struct quota_mailbox_list, 1);
+		qlist->module_ctx.super = list->v;
+		list->v.delete_mailbox = quota_mailbox_list_delete;
+
+		MODULE_CONTEXT_SET(list, quota_mailbox_list_module, qlist);
+	}
 	if (quota_next_hook_mailbox_list_created != NULL)
 		quota_next_hook_mailbox_list_created(list);
 }


More information about the dovecot-cvs mailing list