[Dovecot] RFE: Disallow DELETE of non-empty MBOX

Timo Sirainen tss at iki.fi
Mon Aug 4 23:19:07 EEST 2008


On Aug 4, 2008, at 3:40 PM, Kenneth Porter wrote:

> On Monday, August 04, 2008 2:41 PM -0400 Timo Sirainen <tss at iki.fi>  
> wrote:
>
>> On Aug 4, 2008, at 2:23 PM, Kenneth Porter wrote:
>>
>>> It looks like this is already the rule for maildir, where one can't
>>> remove the folder if any files or subdirectories are present.
>>
>> Oh? I don't remember this kind of a feature..
>
> Just went looking at the 1.1.1 code again and mis-remembered what I  
> saw. I was looking at mbox_list_delete_mailbox and it was the mbox  
> "folder that contains folders" behavior I was remembering. It will  
> only unlink a folder if it contains no subfolders. ISTM that it  
> should either recursively delete for consistency, or not delete non- 
> empty "folder that contains messages" folders. Or does the standard  
> require different behavior here?

Standard says:

> The DELETE command MUST NOT remove inferior hierarchical names. For  
> example, if a mailbox "foo" has an inferior "foo.bar" (assuming "."  
> is the hierarchy delimiter character), removing "foo" MUST NOT  
> remove "foo.bar".


>> The problem is that I think this should be more of a per-client  
>> setting
>> rather than a global setting. For example with Thunderbird (well, and
>> non-mboxes) deleting the mailbox just renames it under Trash.  
>> Disallowing
>> that would be annoying. And I suppose this issue really should be  
>> handled
>> by the client UI instead of the server..
>
> Note that "renaming" under Trash won't work if Trash is mbox,  
> because mbox can't have subfolders. (Or did this change in Dovecot  
> in 1.1.2?)

That's why I said "(well, and non-mboxes)" :)

> I'd be happy to get this functionality as a plugin, but I haven't  
> been able to get my head around how to write a plugin. It looks like  
> some variation of the ACL plugin might do the job, since it also  
> establishes restrictions on whether a delete can go through.

As an example you could look at quota-storage.c  
quota_mailbox_list_delete(). So in there open, sync and call  
mailbox_status() to see if it's non-empty and if so call  
mail_storage_set_error() and don't call super.mailbox_delete().
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 194 bytes
Desc: This is a digitally signed message part
Url : http://dovecot.org/pipermail/dovecot/attachments/20080804/c2986ecf/attachment-0001.bin 


More information about the dovecot mailing list