]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
quota-clone: Fixed update-recursion crash when closing mailbox.
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 19 Jan 2016 13:11:44 +0000 (15:11 +0200)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 19 Jan 2016 13:11:44 +0000 (15:11 +0200)
We need to avoid recursing for all mailboxes that quota recalculation
might open and close, not just the one that triggered the recalculation.

src/plugins/quota-clone/quota-clone-plugin.c

index 2f1452630f72bb869b06dc23ee6d68f7f581a606..76ec96921d784fa50e88eccaabb62313abc114b9 100644 (file)
@@ -24,12 +24,12 @@ static MODULE_CONTEXT_DEFINE_INIT(quota_clone_storage_module,
 struct quota_clone_user {
        union mail_user_module_context module_ctx;
        struct dict *dict;
+       bool quota_flushing;
 };
 
 struct quota_clone_mailbox {
        union mailbox_module_context module_ctx;
        bool quota_changed;
-       bool quota_flushing;
 };
 
 static void quota_clone_flush(struct mailbox *box)
@@ -113,15 +113,17 @@ quota_clone_mailbox_sync_notify(struct mailbox *box, uint32_t uid,
 static void quota_clone_mailbox_close(struct mailbox *box)
 {
        struct quota_clone_mailbox *qbox = QUOTA_CLONE_CONTEXT(box);
+       struct quota_clone_user *quser =
+               QUOTA_CLONE_USER_CONTEXT(box->storage->user);
 
        qbox->module_ctx.super.close(box);
 
-       if (qbox->quota_flushing) {
+       if (quser->quota_flushing) {
                /* recursing back from quota recalculation */
        } else if (qbox->quota_changed) {
-               qbox->quota_flushing = TRUE;
+               quser->quota_flushing = TRUE;
                quota_clone_flush(box);
-               qbox->quota_flushing = FALSE;
+               quser->quota_flushing = FALSE;
        }
 }