[Dovecot] Mailbox Delete
Hi Timo....
I Modify the plugin autocreate, that create and subscribe a mailbox to user.
My modification consist in do the inverse, if my user don't have permission to create and subscribe a folder, the plugin remove and unsubscribe.
My function is called in the same place that create and subscribe is called, just seeing if my flag is "create or delete".
My function i copy from doveadm + autocreate create mailbox.
The delete is made, and works, but i got some errors before the delete.
I thing that is missing something in this function, like delete something else....
static void emexis_antispam_mailbox_delete(struct mail_namespace *namespaces, const char *name) {
struct mail_namespace *ns;
struct mailbox *box;
ns = mail_namespace_find(namespaces, &name);
if (ns != NULL){
box = mailbox_alloc(ns->list, name, 0);
if (mailbox_delete(box) < 0) {
struct mail_storage *storage = mailbox_get_storage(box);
i_error("Can't delete mailbox %s: %s",
name,mail_storage_get_last_error(storage, NULL)); } if (mailbox_mark_index_deleted(box, TRUE) < 0){ struct mail_storage *storage = mailbox_get_storage(box); i_error("Can't delete INDEX %s: %s", name,mail_storage_get_last_error(storage, NULL)); } mailbox_free(&box); } }
I got this errors.
Nov 26 17:39:29 brc dovecot: imap(alex@exemplo.com.br): Panic: file index-status.c: line 144 (index_storage_get_status): assertion failed: (box->opened) Nov 26 17:39:29 brc dovecot: imap(alex@exemplo.com.br): Error: Raw backtrace: /opt/addons/lib/dovecot/libdovecot.so.0 [0xb769275e] -> /opt/addons/lib/dovecot/libdovecot.so.0 [0xb76927bd] -> /opt/addons/lib/dovecot/libdovecot.so.0 [0xb7691db4] -> /opt/addons/lib/dovecot/libdovecot-storage.so.0(index_storage_get_status+0x38d) [0xb770aced] -> /opt/addons/lib/dovecot/lib20_emexis_uis_plugin.so [0xb75009a1] -> /opt/addons/lib/dovecot/libdovecot-storage.so.0(mailbox_delete+0x4e) [0xb76ed36e] -> /opt/addons/lib/dovecot/lib20_emexis_uis_plugin.so [0xb74fff10] -> /opt/addons/lib/dovecot/lib20_emexis_uis_plugin.so [0xb7500280] -> /opt/addons/lib/dovecot/lib20_emexis_uis_plugin.so [0xb7500fa9] -> /opt/addons/lib/dovecot/libdovecot-storage.so.0(hook_mail_namespaces_created+0x31) [0xb76ee011] -> /opt/addons/lib/dovecot/libdovecot-storage.so.0(mail_namespaces_init+0x7c4) [0xb76e71d4] -> /opt/addons/lib/dovecot/libdovecot-storage.so.0(mail_storage_service_next+0x21c) [0xb76f4b9c] -> /opt/addons/lib/dovecot/libdovecot-stor Nov 26 17:39:29 brc dovecot: master: Error: service(imap): child 2830 killed with signal 6 (core dumps disabled)
TKS Timo !!!
On 26.11.2010, at 19.47, Alex Baule wrote:
box = mailbox_alloc(ns->list, name, 0); if (mailbox_delete(box) < 0) { struct mail_storage *storage = mailbox_get_storage(box); i_error("Can't delete mailbox %s: %s",
name,mail_storage_get_last_error(storage, NULL)); }
This should be enough.
if (mailbox_mark_index_deleted(box, TRUE) < 0){ struct mail_storage *storage = mailbox_get_storage(box); i_error("Can't delete INDEX %s: %s",
name,mail_storage_get_last_error(storage, NULL)); }
The mailbox_delete() calls this internally, you shouldn't do it.
/opt/addons/lib/dovecot/libdovecot-storage.so.0(index_storage_get_status+0x38d) [0xb770aced] -> /opt/addons/lib/dovecot/lib20_emexis_uis_plugin.so [0xb75009a1] -> /opt/addons/lib/dovecot/libdovecot-storage.so.0(mailbox_delete+0x4e)
Anyway, this points to the problem being in emexis_uis plugin. It's calling mailbox_get_status() in a delete hook without having the mailbox opened yet. It should probably be calling mailbox_open() first.
It's strange, because if i comment the call for my function mailbox_delete, i don't get the error.
Only if i delete it.
i will check the rest of code...
Tks Timo !
2010/11/26 Timo Sirainen <tss@iki.fi>
On 26.11.2010, at 19.47, Alex Baule wrote:
box = mailbox_alloc(ns->list, name, 0); if (mailbox_delete(box) < 0) { struct mail_storage *storage = mailbox_get_storage(box); i_error("Can't delete mailbox %s: %s",
name,mail_storage_get_last_error(storage, NULL)); }
This should be enough.
if (mailbox_mark_index_deleted(box, TRUE) < 0){ struct mail_storage *storage = mailbox_get_storage(box); i_error("Can't delete INDEX %s: %s",
name,mail_storage_get_last_error(storage, NULL)); }
The mailbox_delete() calls this internally, you shouldn't do it.
/opt/addons/lib/dovecot/libdovecot-storage.so.0(index_storage_get_status+0x38d)
[0xb770aced] -> /opt/addons/lib/dovecot/lib20_emexis_uis_plugin.so [0xb75009a1] -> /opt/addons/lib/dovecot/libdovecot-storage.so.0(mailbox_delete+0x4e)
Anyway, this points to the problem being in emexis_uis plugin. It's calling mailbox_get_status() in a delete hook without having the mailbox opened yet. It should probably be calling mailbox_open() first.
participants (2)
-
Alex Baule
-
Timo Sirainen