[Dovecot] Quota

Thomas Wouters thomas at xs4all.net
Fri Apr 22 02:26:23 EEST 2005


On Thu, Apr 21, 2005 at 10:12:43PM +0300, Timo Sirainen wrote:
> On 20.4.2005, at 04:52, Thomas Wouters wrote:

> Fixed and uploaded new quota.tar.gz to same place.

Thanks! I'll look at it tomorrow, and integrate it in my changes.
quota-rquotad works, by the way; I'll clean it up a bit and provide a patch
against quota.tar.gz. It still needs extensive testing, but I have eager
coworkers waiting for just that :)

> >The rquotad plugin is done, more or less, except for figuring out how to
> >properly get at a mailbox's physical location, if it has one. I really
> >don't want to maintain a static list in an environment variable; we
> >currently use 10 different filesystems (all NFS) for mail storage, and
> >they all have different quotas and usage.

> Well, that requires mbox/maildir-specific storage code then to get the 
> path.. I think zlib plugin checks that it works only with mboxes, that 
> might be helpful.

Hmm. I currently cheat, casting the struct_mailbox to a struct index_storage
and using its 'dir' member. I don't even check that it is an index_storage
struct; I know I should, but when wouldn't it be ?

> >I don't particularly care about checking quotas before an attempted
> >write, but I implemented that as best I could; I still need to figure out
> >how to decode the mail_transaction_context to see where a mail is moved
> >from/to in order to finish it.

> Probably just by checking if it's mbox/maildir and then casting struct 
> mailbox to struct maildir_mailbox and looking what it contains.. Or if 
> you actually want to see the filenames it gets more difficult.

Well, to properly check quotas, I'd have to compare quotaroots of the source
and destination both (in case of a move), then do the proper calculation
(taking into account blocksize of disk and such) -- I think I'll just skip
that check. Quotas are enforced by the filesystem anyway.

> >The quota-plugin thing obviously isn't quite done yet (at least, not the
> >tarball version from the patches/1.0 directory) -- it lacks some error
> >checking, I think,

> I don't remember leaving anything intentionally?

The one I ran into was cmd_getquotaroot not checking the return value of
quota_root_iter_init(), and my quota_root_iter_init() was failing. At the
time, I thought the reason of that failure was another part of the code, but
it was 4AM, I don't quite remember what I thought it was and I don't think
it really was that anyway.

Something else I noticed was that the storage quota name should (for
Thunderbird, at least) be allcaps, or it won't recognize it as storage
quota. Thunderbird doesn't do message quota (which I implemented as 'inode
quota', as I'm maildir-centric) but I suspect that should probably be
allcaps as well, for interoperability if nothing else.

And there's the bit where you need to set the MODULE_DIR and QUOTA
environment variables and start imap by hand, rather than by dovecot. I
hacked around that by hardcoding both in the source.

> Easiest way would be just to put the capability string into config file.

That's what I ended up doing, after I reread RFC2087 and realized I'd missed
the capability.

Thanks for the comments and the update,
-- 
Thomas Wouters <thomas at xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!



More information about the dovecot mailing list