dovecot-2.0: lib-storage: Don't wrongly ignore subscriptions=no ...

dovecot at dovecot.org dovecot at dovecot.org
Fri Oct 1 23:33:42 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/da9185d1309c
changeset: 12229:da9185d1309c
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Oct 01 21:33:38 2010 +0100
description:
lib-storage: Don't wrongly ignore subscriptions=no namespace entries.

diffstat:

 src/lib-storage/list/mailbox-list-subscriptions.c |  19 +++++++++++++++----
 src/lib-storage/list/subscription-file.c          |   8 --------
 2 files changed, 15 insertions(+), 12 deletions(-)

diffs (68 lines):

diff -r 39ef52bc4999 -r da9185d1309c src/lib-storage/list/mailbox-list-subscriptions.c
--- a/src/lib-storage/list/mailbox-list-subscriptions.c	Fri Oct 01 19:09:29 2010 +0100
+++ b/src/lib-storage/list/mailbox-list-subscriptions.c	Fri Oct 01 21:33:38 2010 +0100
@@ -17,7 +17,7 @@
 	struct mailbox_list_iter_update_context update_ctx;
 	struct subsfile_list_context *subsfile_ctx;
 	struct mail_namespace *ns;
-	const char *path, *name, *name2, *full_name;
+	const char *path, *name, *name2, *full_name, *orig_name;
 	string_t *vname;
 
 	vname = str_new(default_pool, 256);
@@ -38,6 +38,7 @@
 		(ctx->flags & MAILBOX_LIST_ITER_SELECT_RECURSIVEMATCH) != 0;
 
 	while ((name = subsfile_list_next(subsfile_ctx)) != NULL) T_BEGIN {
+		orig_name = name;
 		full_name = name2 =
 			t_strconcat(default_ns->prefix, name, NULL);
 		ns = mail_namespace_find_unsubscribable(namespaces, &name2);
@@ -45,7 +46,9 @@
 			ns = default_ns;
 		else if (ns->type == NAMESPACE_SHARED &&
 			 (ns->flags & NAMESPACE_FLAG_AUTOCREATED) == 0) {
-			/* we'll need to get the namespace autocreated. */
+			/* we'll need to get the namespace autocreated.
+			   one easy way is to just ask if a mailbox name under
+			   it is valid, and it gets created */
 			(void)mailbox_list_is_valid_existing_name(ns->list,
 								  name2);
 			name = full_name;
@@ -54,8 +57,16 @@
 		} else {
 			name = name2;
 		}
-		name = mail_namespace_get_vname(ns, vname, name);
-		mailbox_list_iter_update(&update_ctx, name);
+
+		if (!mailbox_list_is_valid_existing_name(ns->list, name)) {
+			/* we'll only get into trouble if we show this */
+			i_warning("Subscriptions file %s: "
+				  "Ignoring invalid entry: %s",
+				  path, orig_name);
+		} else {
+			name = mail_namespace_get_vname(ns, vname, name);
+			mailbox_list_iter_update(&update_ctx, name);
+		}
 	} T_END;
 	str_free(&vname);
 	return subsfile_list_deinit(subsfile_ctx);
diff -r 39ef52bc4999 -r da9185d1309c src/lib-storage/list/subscription-file.c
--- a/src/lib-storage/list/subscription-file.c	Fri Oct 01 19:09:29 2010 +0100
+++ b/src/lib-storage/list/subscription-file.c	Fri Oct 01 21:33:38 2010 +0100
@@ -245,14 +245,6 @@
         for (i = 0;; i++) {
                 line = next_line(ctx->list, ctx->path, ctx->input, &ctx->failed,
 				 i < SUBSCRIPTION_FILE_ESTALE_RETRY_COUNT);
-		if (line != NULL &&
-		    !mailbox_list_is_valid_existing_name(ctx->list, line)) {
-			/* we'll only get into trouble if we show this */
-			i_warning("Subscriptions file %s: "
-				  "Ignoring invalid entry: %s",
-				  ctx->path, line);
-			continue;
-		}
 		if (ctx->input->stream_errno != ESTALE ||
                     i == SUBSCRIPTION_FILE_ESTALE_RETRY_COUNT)
                         break;


More information about the dovecot-cvs mailing list