dovecot-2.0: doveadm acl debug: If any errors are noticed, fix t...
dovecot at dovecot.org
dovecot at dovecot.org
Fri Mar 4 18:09:33 EET 2011
details: http://hg.dovecot.org/dovecot-2.0/rev/325e163a6f84
changeset: 12639:325e163a6f84
user: Timo Sirainen <tss at iki.fi>
date: Fri Mar 04 18:09:01 2011 +0200
description:
doveadm acl debug: If any errors are noticed, fix them.
diffstat:
src/plugins/acl/doveadm-acl.c | 37 +++++++++++++++++++++++++++----------
1 files changed, 27 insertions(+), 10 deletions(-)
diffs (82 lines):
diff -r 313e9af474a4 -r 325e163a6f84 src/plugins/acl/doveadm-acl.c
--- a/src/plugins/acl/doveadm-acl.c Fri Mar 04 18:08:30 2011 +0200
+++ b/src/plugins/acl/doveadm-acl.c Fri Mar 04 18:09:01 2011 +0200
@@ -334,7 +334,7 @@
return ctx;
}
-static bool cmd_acl_debug_mailbox(struct mailbox *box)
+static bool cmd_acl_debug_mailbox(struct mailbox *box, bool *retry_r)
{
struct mail_namespace *ns = mailbox_get_namespace(box);
struct acl_user *auser = ACL_USER_CONTEXT(ns->user);
@@ -345,6 +345,9 @@
const char *const *rights, *name;
string_t *str;
int ret;
+ bool all_ok = TRUE;
+
+ *retry_r = FALSE;
if (box->private_flags_mask == 0)
i_info("All message flags are shared across users in mailbox");
@@ -386,10 +389,14 @@
if (ret < 0)
i_fatal("ACL non-owner iteration failed");
if (ret == 0) {
- i_error("Mailbox not found from dovecot-acl-list");
- return FALSE;
+ i_error("Mailbox not found from dovecot-acl-list, rebuilding");
+ if (acl_backend_nonowner_lookups_rebuild(backend) < 0)
+ i_fatal("dovecot-acl-list rebuilding failed");
+ all_ok = FALSE;
+ *retry_r = TRUE;
+ } else {
+ i_info("Mailbox found from dovecot-acl-list");
}
- i_info("Mailbox found from dovecot-acl-list");
if (ns->type == NAMESPACE_PUBLIC) {
i_info("Mailbox is in public namespace");
@@ -410,13 +417,17 @@
if (acl_lookup_dict_iterate_visible_deinit(&diter) < 0)
i_fatal("ACL shared dict iteration failed");
if (name == NULL) {
- i_error("User %s not found from ACL shared dict",
+ i_error("User %s not found from ACL shared dict, rebuilding",
ns->owner->username);
- return FALSE;
+ if (acl_lookup_dict_rebuild(auser->acl_lookup_dict) < 0)
+ i_fatal("ACL lookup dict rebuild failed");
+ all_ok = FALSE;
+ *retry_r = TRUE;
+ } else {
+ i_info("User %s found from ACL shared dict",
+ ns->owner->username);
}
-
- i_info("User %s found from ACL shared dict", ns->owner->username);
- return TRUE;
+ return all_ok;
}
static void
@@ -424,11 +435,17 @@
{
const char *mailbox = ctx->args[0];
struct mailbox *box;
+ bool ret, retry;
if (cmd_acl_mailbox_open(user, mailbox, &box) < 0)
return;
- if (cmd_acl_debug_mailbox(box))
+ ret = cmd_acl_debug_mailbox(box, &retry);
+ if (!ret && retry) {
+ i_info("Retrying after rebuilds:");
+ ret = cmd_acl_debug_mailbox(box, &retry);
+ }
+ if (ret)
i_info("Mailbox %s is visible in LIST", box->vname);
else
i_info("Mailbox %s is NOT visible in LIST", box->vname);
More information about the dovecot-cvs
mailing list