2.3.13 - fails to unlinking quota file

Bron Gondwana brong at fastmail.fm
Sat Feb 7 20:20:07 EST 2009


On Sat, Feb 07, 2009 at 12:29:54PM +0100, Wolfgang Powisch wrote:
> I think I've encountered a bug in 2.3.13, when I delete a Mailbox, the
> corresponding quota-file isn't removed, and log-output shows that it
> tries to unlink a wrong filename. All other files are removed correctly.
> 
> I'm using default quota_db (quotalegacy) and fulldirhash.
> 
> Adding some more debug output to code it seems that quota->root get's
> free'd at some point before the commit is called, which should unlink 
> the file.

Looks like the whole quota system is pretty broken actually!

imap/mboxlist.c
1021:    int deletequotaroot = 0;
1143:    if (!r || force) r = mailbox_delete(&mailbox, deletequotaroot, NULL);

Notice the complete lack of any code which actually sets deletequotaroot!

Also,

/*
 *  Remove a quota root
 */
int mboxlist_unsetquota(const char *root)

-------------

imap/mbdump.c
535:    mboxlist_unsetquota(mbname);

imap/mboxlist.c
2691:int mboxlist_unsetquota(const char *root)

imap/mboxlist.h
198:int mboxlist_unsetquota(const char *root);

-------------

It's only called from mbdump, so the "unsetquota" path isn't usually
being used.

There's stuff in imap/user.c for dealing with quotas as well, but back
to "deletequotaroot" above, check out the code around it:

    if (!r || force) r = mailbox_delete(&mailbox, deletequotaroot, NULL);

    /*
     * See if we have to remove mailbox's quota root
     */
    if (!r && mailbox.quota.root != NULL) {
        /* xxx look for any other mailboxes in this quotaroot */
    }

Yeah, ho hum.  So I guess we don't bother trying then.

I'm not, off the top of my head, sure how much quota.root looks like a
mailbox, and internal mailbox, or a filesystem path.  I'm not sure that
the code is 100% clarified on this at all places either!  I've been
looking into exactly that issue while trying to make sure all the buffer
sizes are correct for handling DELETED.* mailbox names safely and
allowing users to be able to delete any mailbox name they are able to
create!

Bron.


More information about the Info-cyrus mailing list