dovecot-2.0: LIST (SUBSCRIBED): Don't assert-crash if list conta...

dovecot at dovecot.org dovecot at dovecot.org
Thu Mar 4 16:52:14 EET 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/c691706eee06
changeset: 10831:c691706eee06
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Mar 04 16:52:11 2010 +0200
description:
LIST (SUBSCRIBED): Don't assert-crash if list contained a name ending with separator.

diffstat:

 src/lib-storage/list/mailbox-list-fs-iter.c |  11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diffs (28 lines):

diff -r fe302c2714a3 -r c691706eee06 src/lib-storage/list/mailbox-list-fs-iter.c
--- a/src/lib-storage/list/mailbox-list-fs-iter.c	Wed Mar 03 18:32:28 2010 +0200
+++ b/src/lib-storage/list/mailbox-list-fs-iter.c	Thu Mar 04 16:52:11 2010 +0200
@@ -618,7 +618,8 @@
 {
 	struct mailbox_node *node;
 	enum mailbox_info_flags flags;
-	const char *path, *dir, *fname;
+	const char *path, *dir, *fname, *name;
+	unsigned int len;
 	struct stat st;
 
 	node = mailbox_tree_iterate_next(ctx->tree_iter, &ctx->info.name);
@@ -634,7 +635,13 @@
 		return &ctx->info;
 	}
 
-	path = mailbox_list_get_path(ctx->ctx.list, ctx->info.name,
+	/* if name ends with hierarchy separator, drop the separator */
+	name = ctx->info.name;
+	len = strlen(name);
+	if (len > 0 && name[len-1] == ctx->info.ns->real_sep)
+		name = t_strndup(name, len-1);
+
+	path = mailbox_list_get_path(ctx->ctx.list, name,
 				     MAILBOX_LIST_PATH_TYPE_DIR);
 	path_split(path, &dir, &fname);
 	if (ctx->ctx.list->v.get_mailbox_flags(ctx->ctx.list, dir, fname,


More information about the dovecot-cvs mailing list