dovecot-2.0: acl: Don't assert-crash if LIST returns mailbox nam...
dovecot at dovecot.org
dovecot at dovecot.org
Sun Feb 28 21:22:55 EET 2010
details: http://hg.dovecot.org/dovecot-2.0/rev/64f6c458aaff
changeset: 10818:64f6c458aaff
user: Timo Sirainen <tss at iki.fi>
date: Sun Feb 28 21:22:53 2010 +0200
description:
acl: Don't assert-crash if LIST returns mailbox name ending with separator.
diffstat:
src/plugins/acl/acl-mailbox-list.c | 24 ++++++++++++++++++------
1 files changed, 18 insertions(+), 6 deletions(-)
diffs (37 lines):
diff -r a5b4cbf46b9b -r 64f6c458aaff src/plugins/acl/acl-mailbox-list.c
--- a/src/plugins/acl/acl-mailbox-list.c Sun Feb 28 20:10:56 2010 +0200
+++ b/src/plugins/acl/acl-mailbox-list.c Sun Feb 28 21:22:53 2010 +0200
@@ -223,15 +223,27 @@
const char *name)
{
struct mail_namespace *ns = ctx->list->ns;
+ unsigned int len;
+ char sep;
if ((ctx->flags & MAILBOX_LIST_ITER_VIRTUAL_NAMES) == 0)
- return name;
+ sep = ns->sep;
+ else {
+ /* Mailbox names contain namespace prefix,
+ except when listing INBOX. */
+ if (strncmp(name, ns->prefix, ns->prefix_len) == 0)
+ name += ns->prefix_len;
+ name = mail_namespace_fix_sep(ns, name);
+ sep = ns->real_sep;
+ }
- /* Mailbox names contain namespace prefix,
- except when listing INBOX. */
- if (strncmp(name, ns->prefix, ns->prefix_len) == 0)
- name += ns->prefix_len;
- return mail_namespace_fix_sep(ns, name);
+ len = strlen(name);
+ if (name[len-1] == sep) {
+ /* name ends with separator. this can happen if doing e.g.
+ LIST "" foo/% and it lists "foo/". */
+ name = t_strndup(name, len-1);
+ }
+ return name;
}
static bool
More information about the dovecot-cvs
mailing list