Mercurial > dovecot > core-2.2
changeset 11789:54807112d1d6
acl: Fixed crashing on FS layout with non-default hierarchy separator.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sun, 11 Jul 2010 19:19:45 +0100 |
parents | 486754f4f2ea |
children | b25a30644e68 |
files | src/plugins/acl/acl-mailbox-list.c |
diffstat | 1 files changed, 8 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/plugins/acl/acl-mailbox-list.c Sun Jul 11 18:56:39 2010 +0100 +++ b/src/plugins/acl/acl-mailbox-list.c Sun Jul 11 19:19:45 2010 +0100 @@ -288,7 +288,8 @@ str_append_c(pattern, '%'); } } - str_append_c(pattern, ctx->sep); + if (i > 0 && ctx->info.name[i-1] != ctx->sep) + str_append_c(pattern, ctx->sep); str_append_c(pattern, '*'); prefix = str_c(pattern); prefix_len = str_len(pattern) - 1; @@ -329,8 +330,12 @@ ACL_STORAGE_RIGHT_LOOKUP, NULL); if (ret != 0) { - if ((info->flags & MAILBOX_CHILDREN) != 0 && - !iter_mailbox_has_visible_children(ctx, FALSE)) { + if ((ctx->ctx.flags & MAILBOX_LIST_ITER_RETURN_NO_FLAGS) != 0) { + /* don't waste time checking if there are visible + children, but also don't return incorrect flags */ + info->flags &= ~MAILBOX_CHILDREN; + } else if ((info->flags & MAILBOX_CHILDREN) != 0 && + !iter_mailbox_has_visible_children(ctx, FALSE)) { info->flags &= ~MAILBOX_CHILDREN; info->flags |= MAILBOX_NOCHILDREN; }