[Dovecot] RFE: Disallow DELETE of non-empty MBOX
It looks like this is already the rule for maildir, where one can't remove the folder if any files or subdirectories are present. I'd like to get this option for mbox folders, as I'd like to prevent "accidents" where users accidentally delete large folders by clicking the wrong thing and then too-quickly approving the confirmation dialog that pops up. (Impatient upper level management tends to do this. ;))
BTW, I'm using Mulberry for my client, and it unfortunately puts "Mark contents seen" right next to "Delete folder" on the context menu. I'm aware of the issue so I tend to be extra careful when I finish with the folder associated with a busy mailing list and mark all the uninteresting messages seen.
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..
I'd like to get this option for mbox folders, as I'd like to prevent
"accidents" where users accidentally delete large folders by
clicking the wrong thing and then too-quickly approving the
confirmation dialog that pops up. (Impatient upper level management
tends to do this. ;))
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..
Anyway, I guess it would be nice to have this, but I also really hate
adding more settings to Dovecot right now.
On Monday, August 04, 2008 2:41 PM -0400 Timo Sirainen <tss@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?
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?)
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.
On Aug 4, 2008, at 3:40 PM, Kenneth Porter wrote:
On Monday, August 04, 2008 2:41 PM -0400 Timo Sirainen <tss@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().
It occurs to me that another possibility is to make only the Trash folder maildir, but I think Tbird only allows setting the "folders can contain both messages and folders" option account-wide, not per-folder.
On Aug 4, 2008, at 3:42 PM, Kenneth Porter wrote:
It occurs to me that another possibility is to make only the Trash
folder maildir, but I think Tbird only allows setting the "folders
can contain both messages and folders" option account-wide, not per- folder.
You could switch to Maildir++ layout for mboxes to get dual-use
mailboxes:
mail_location = mbox:~/mail:LAYOUT=maildir++
On Monday, August 4 at 04:15 PM, quoth Timo Sirainen:
On Aug 4, 2008, at 3:42 PM, Kenneth Porter wrote:
It occurs to me that another possibility is to make only the Trash folder maildir, but I think Tbird only allows setting the "folders can contain both messages and folders" option account-wide, not per-folder.
You could switch to Maildir++ layout for mboxes to get dual-use mailboxes:
mail_location = mbox:~/mail:LAYOUT=maildir++
If you do that, though, you have to put your INDEXES somewhere else. Otherwise you get warnings like this:
dovecot: Error: IMAP(user@example.net): open() failed with file /domains/example.net/user/mail/. Trash.DeleteMe/dovecot.index.log: Not a directory
It's not a directory, obviously, because .Trash.DeleteMe is the mbox file.
~Kyle
As far as the laws of mathematics refer to reality, they are not certain, and as far as they are certain, they do not refer to reality. -- Albert Einstein
participants (3)
-
Kenneth Porter
-
Kyle Wheeler
-
Timo Sirainen