dovecot-2.2: lib-storage: mailbox_settings_find() now takes name...

dovecot at dovecot.org dovecot at dovecot.org
Fri May 2 08:59:32 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/930b6b1346bd
changeset: 17305:930b6b1346bd
user:      Timo Sirainen <tss at iki.fi>
date:      Fri May 02 11:58:52 2014 +0300
description:
lib-storage: mailbox_settings_find() now takes namespace parameter instead of user.
This fixes an infinite (until stack gets full) loop with shared mailboxes:
mail_namespace_find() -> mailbox_list_get_storage() ->
mailbox_settings_find() -> mail_namespace_find() -> ...

diffstat:

 src/lib-storage/list/mailbox-list-iter.c |  2 +-
 src/lib-storage/mail-storage.c           |  6 ++----
 src/lib-storage/mail-storage.h           |  2 +-
 src/lib-storage/mailbox-list.c           |  2 +-
 4 files changed, 5 insertions(+), 7 deletions(-)

diffs (62 lines):

diff -r e84555e6eb59 -r 930b6b1346bd src/lib-storage/list/mailbox-list-iter.c
--- a/src/lib-storage/list/mailbox-list-iter.c	Fri May 02 11:40:05 2014 +0300
+++ b/src/lib-storage/list/mailbox-list-iter.c	Fri May 02 11:58:52 2014 +0300
@@ -958,7 +958,7 @@
 
 	ctx->list->ns->flags |= NAMESPACE_FLAG_USABLE;
 	if ((ctx->flags & MAILBOX_LIST_ITER_RETURN_SPECIALUSE) != 0) {
-		set = mailbox_settings_find(ctx->list->ns->user, info->vname);
+		set = mailbox_settings_find(ctx->list->ns, info->vname);
 		if (set != NULL && *set->special_use != '\0') {
 			ctx->specialuse_info = *info;
 			ctx->specialuse_info.special_use =
diff -r e84555e6eb59 -r 930b6b1346bd src/lib-storage/mail-storage.c
--- a/src/lib-storage/mail-storage.c	Fri May 02 11:40:05 2014 +0300
+++ b/src/lib-storage/mail-storage.c	Fri May 02 11:58:52 2014 +0300
@@ -620,12 +620,10 @@
 }
 
 const struct mailbox_settings *
-mailbox_settings_find(struct mail_user *user, const char *vname)
+mailbox_settings_find(struct mail_namespace *ns, const char *vname)
 {
 	struct mailbox_settings *const *box_set;
-	struct mail_namespace *ns;
 
-	ns = mail_namespace_find(user->namespaces, vname);
 	if (!array_is_created(&ns->set->mailboxes))
 		return NULL;
 
@@ -687,7 +685,7 @@
 		}
 
 		box = storage->v.mailbox_alloc(storage, new_list, vname, flags);
-		box->set = mailbox_settings_find(storage->user, vname);
+		box->set = mailbox_settings_find(new_list->ns, vname);
 		box->open_error = open_error;
 		if (open_error != 0)
 			mail_storage_set_error(storage, open_error, errstr);
diff -r e84555e6eb59 -r 930b6b1346bd src/lib-storage/mail-storage.h
--- a/src/lib-storage/mail-storage.h	Fri May 02 11:40:05 2014 +0300
+++ b/src/lib-storage/mail-storage.h	Fri May 02 11:58:52 2014 +0300
@@ -540,7 +540,7 @@
 mailbox_get_settings(struct mailbox *box) ATTR_PURE;
 /* Returns the mailbox's settings, or NULL if there are none. */
 const struct mailbox_settings *
-mailbox_settings_find(struct mail_user *user, const char *vname);
+mailbox_settings_find(struct mail_namespace *ns, const char *vname);
 
 /* Returns the (virtual) name of the given mailbox. */
 const char *mailbox_get_vname(const struct mailbox *box) ATTR_PURE;
diff -r e84555e6eb59 -r 930b6b1346bd src/lib-storage/mailbox-list.c
--- a/src/lib-storage/mailbox-list.c	Fri May 02 11:40:05 2014 +0300
+++ b/src/lib-storage/mailbox-list.c	Fri May 02 11:58:52 2014 +0300
@@ -818,7 +818,7 @@
 	if ((*list)->v.get_storage != NULL)
 		return (*list)->v.get_storage(list, vname, storage_r);
 
-	set = mailbox_settings_find((*list)->ns->user, vname);
+	set = mailbox_settings_find((*list)->ns, vname);
 	if (set != NULL && set->driver != NULL && set->driver[0] != '\0') {
 		return mailbox_list_get_storage_driver(*list, set->driver,
 						       storage_r);


More information about the dovecot-cvs mailing list