Deleting top-level mailbox with 'delete_mode: delayed'

Simon Matter simon.matter at invoca.ch
Wed Nov 14 04:24:43 EST 2007


> On Tue, 13 Nov 2007, Bron Gondwana wrote:
>
>> I have "delete_mode: immediate" on the replica and "delete_mode:
>> delayed" on the master.
>
> sync_server doesn't pay any attention to delete_mode, so the option
> shouldn't have any effect on the replica.

Okay, things are a bit more clear now. With "allowusermoves: no", which is
the default, "delete_mode: delayed" doesn't work for deleting user
mailboxes. The quick patch below makes things work but I understand it's
not a clean solution. Am I supposed to enable "allowusermoves" explicitly
when using "delete_mode: delayed"? Would it make sense to add an isdeleted
flag to mboxname_isusermailbox() so the code below could check whether to
override the "allowusermoves" setting for delayed mailbox deletion?
Due to the lack of sane C skills I feel unable to provide a proper fix...

Thanks,
Simon

[root at monster imap]# diff -Nau mboxlist.c.ver-20071114083143 mboxlist.c
--- mboxlist.c.ver-20071114083143       2007-10-01 20:35:59.000000000 +0200
+++ mboxlist.c  2007-11-14 09:42:55.000000000 +0100
@@ -1221,7 +1221,8 @@
              goto done;
            }
            isusermbox = 1;
-       } else if (config_getswitch(IMAPOPT_ALLOWUSERMOVES) &&
+       } else if ((config_getswitch(IMAPOPT_ALLOWUSERMOVES) ||
+                  mboxlist_delayed_delete_isenabled()) &&
                   mboxname_isusermailbox(newname, 1)) {
            /* Special case of renaming a user */
            access = cyrus_acl_myrights(auth_state, oldacl);
@@ -1253,7 +1254,8 @@
     /* Check ability to create new mailbox */
     if (!partitionmove) {
        if (mboxname_isusermailbox(newname, 1)) {
-           if (config_getswitch(IMAPOPT_ALLOWUSERMOVES) &&
+           if ((config_getswitch(IMAPOPT_ALLOWUSERMOVES) ||
+               mboxlist_delayed_delete_isenabled()) &&
                mboxname_isusermailbox(oldname, 1)) {
                if (!isadmin) {
                    /* Only admins can rename users (INBOX to INBOX) */




More information about the Info-cyrus mailing list