Remove the quota on deletion of a folder that has no children - patch for Cyrus


Cyrus imap doesn't remove the quota from a folder when this folder is deleted except if the folder is user.X folder. There are some comments in Cyrus code about possible places where code can be inserted to deal with this situation.
This patch is a suggestion on the behaviour of cyrus-imap when a folder is deleted. With this patch the quota is removed in two cases:

  1. The user explicitely requests the deletetion of quota. In order to request the deletion of the quota the convention that + must procceed the name of the folder was used. i.e if i want to delete the folder koko.lala and remove the the quota the command would be:
    	. delete +koko.lala
  2. The soon-to-be-deleted-folder's quota root has no subfolders. Then we can assume that the reasonable thing to do is to delete also the quota. This actually can mean two things. If the folder's quota root is the folder himself then this means that this folder has no subfolder. If the folder's quota root is a higher-level non-existent subfolder this means that the soon-to-be-deleted-folder is its only subfolder.

ATTENTION: This patch needs also the rmquota patch . That's why it is distributed in two different patches. One unified with rmquota in order to be used in an vanilla cyrus imap tree, and one "stand-alone" to be used with an already patched cyrus imap with rmquota patch.


Sep, 03 2007: Patch for cyrus 2.3.9 is out.
Jun, 17 2005: New Patch for cyrus 2.2.12 is out. Fixes a small error at a pointer . ( diff to previous).
Mar, 4 2005: Patch for cyrus 2.2.12 is out. Patch filename is updated to new format.
Nov, 24 2004: Patch for cyrus 2.2.10 is out.
Jul, 27 2004: Patch for cyrus 2.2.7 is out.
Jul, 08 2004: Bug fix for the deletemailbox patch for cyrus 2.2.6. Patch update to version 0.2. ( diff to previous). The problem was found after watching a long thread in info-cyrus about vanishing quota information. (In the mean time, another bug was found and fixed in the cyrus tree, about quota information). Thanks to Simon Matter for providing valuable feedback, and testing the version of the patch. There might be a problem with some old versions of Redhat (that is what Simon Matter reported) so in this case use the rpms.
Jun, 20 2004: Patch for cyrus 2.2.6 is out.
Jun, 1 2004: new deletemailbox 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)
Mar, 31 2004: Initial release for the patch. Applied to cyrus 2.2.5.


Installation instructions


Things to be done are :

Contact information

For information, bugs, requests etc contact email (at)