This patch for the Cyrus IMAP server addresses a subtle but important issue
with the Cyrus quota mechanism. When a folder is assigned a quota it becomes a
quota root for all subfolders except those that have quotas defined and their
children. Under Cyrus it is not possible to remove a quota root, and reassign
the relevant subfolders to a parent quota root.
The following exposition is perhaps too technical for someone not familiar
with the IMAP quota extension and the Cyrus project's implementation.
The parent quota root of a folder is the first quota root found enroute to the root of the hierarchy. A quota root defines resource limits which apply to a folder and to all subfolders except those that are themselves quota roots or those that have a different parent quota root.
The phrase "folder X has no quota" is usually used in an ambiguous manner; it can mean:
The difference is evident from the output of the GETQUOTA command on a Cyrus IMAP server. In case number 1 where a folder has no quota limit we get:
. GETQUOTA test.qroot * QUOTA test.qroot () . OK CompletedIn case number 2 where the folder doesn't have a quota file we get:
. getquota test.noqroot . NO Quota root does not exist
Consider the example hierarchy:
. LIST test * * LIST (\HasChildren) "." "test" * LIST (\HasChildren) "." "test.root" * LIST (\HasChildren) "." "test.root.subroot" * LIST (\HasNoChildren) "." "test.root.subroot.subfolder" * LIST (\HasNoChildren) "." "test.root.subfolder" . OK Completed (0.000 secs 15 calls)and suppose root and subroot are themselves quota roots:
. GETQUOTAROOT test.root * QUOTAROOT test.root test.root * QUOTA test.root (STORAGE 0 100) . OK Completed . GETQUOTAROOT test.root.subroot * QUOTAROOT test.root.subroot test.root.subroot * QUOTA test.root.subroot (STORAGE 0 200) . OK CompletedNow say we want to remove the quota limit for test.root.subroot. In Cyrus this means that the quota file for this quota root will have a limit of '-1'. It is accomplished by giving a SETQUOTA command with no arguments:
. SETQUOTA test.root.subroot () . OK Completed . GETQUOTA test.root.subroot * QUOTA test.root.subroot () . OK CompletedThe alternative meaning is totaly different. We wish to remove the quota file from test.root.subroot so as itself and it's subfolders now belong to the quota root at test.root.
The rmquota patch makes the alternative meaning also possible, by introducing a dummy resource atom called 'remove'. When this resource is set on a folder any quota file will be removed and the affected subfolders will be updated correctly:
. SETQUOTA test.root.subroot (REMOVE 1) . OK Completed . GETQUOTA test.root.subroot . NO Quota root does not exist . GETQUOTAROOT test.root.subroot * QUOTAROOT test.root.subroot test.root * QUOTA test.root (STORAGE 0 100) . OK Completed . GETQUOTAROOT test.root.subroot.subfolder * QUOTAROOT test.root.subroot.subfolder test.root * QUOTA test.root (STORAGE 0 100) . OK Completed
We believe that this extension is compatible with RFC2087 although it may stretch a bit the intentions of the authors. According to the RFC SETQUOTA accepts a "list of resource limits" as the second argument, in which case one can regard REMOVE as a dummy "resource".
This patch was an in-house hack for almost 2 years, originally written to support the web administration tool Cyrusmaster. The functionality it provides could not be replicated unless one erased the quota file by hand and then reconstructed the mailbox headers of the affected folders. Obviously a web administration tool could not do all this automatically and to ask the user to do it manually would defeat the purpose of a web administration tool. It has been tidied up and written so as to integrate with and contribute to the cyrus code base in a better way.
Sep, 07 2007: new remove quota file patch for cyrus 2.3.9 ready.
Mar, 4 2005: new remove quota file patch for cyrus 2.2.12 ready. Patch filename is updated to new
format.
Nov, 24 2004: new remove quota file patch for cyrus 2.2.10 ready.
Jul, 31 2004: There will be no release for the patches for cyrus imapd 2.2.8 since
they are identical with the patches for cyrus-imapd-2.2.7. Just use those.
Jul, 27 2004: new remove quota file patch for cyrus 2.2.7 ready.
Jun, 20 2004: new remove quota file patch for cyrus 2.2.6 ready.
Jun, 1 2004: new remove quota file patch for cyrus 2.2.5. As Simmon Matter reported there was
a problem compiling with gcc 3.3.x because the wrapping of the lines in the syslog message made gcc produce an
error. This is quite strange cause I've tested it with gcc 3.2.3 and the patch worked ok. Anyhow a new patch that
adds two \ in the right places is out. (Building proccess was tested by Simmon). Special thanks to Simon Matters
( diff to previous)
May, 31 2004: new remove quota file patch for cyrus 2.2.5. A few minor changes.
( diff to previous)
May, 28 2004: new remove quota file patch for cyrus 2.2.4 ready. A quite reworked patch.
Mar, 24 2004: new remove quota file patch for cyrus 2.2.3-CVS ready. Fixes problems with non
existent folders
Mar, 11 2004: remove quota file patch for cyrus 2.2.3-CVS ready
Jan, 23 2004: remove quota file patch for cyrus 2.2.3 ready
Dec, 05 2003: bug fix (stray 2.2 variable) for 2.1.16 patch. Thanks to Simon Matter for pointing it out
Dec, 03 2003: remove quota file patch for cyrus 2.2.2-BETA ready
Cyrus IMAPd 2.3.x
Latest patch for cyrus 2.3.9 is
cyrus-imapd-2.2.9-rmquota-0.5-0.diff
Cyrus IMAPd 2.2.x
Latest patch for cyrus 2.2-CVS is
cyrus-imapd-2.2.3-CVS-rmquota-0.2.diff
Cyrus IMAPd 2.1.x
Latest patch for cyrus 2.1.16 is
cyrus-imapd-2.1.16-rmquota-0.3.diff
More Cyrus patches
Cyrusmaster: a Cyrus administration web environment
email.uoa.gr homepage
For information, bugs, requests etc contact email (at) edunet.gr