# HG changeset patch # User Timo Sirainen # Date 1257898371 18000 # Node ID 38d89637aa2305038d585059009a287604b30290 # Parent adcc779985bd842394fe5056546c6aa4f3adde9c acl: mailbox_name_status() shouldn't hide its existence if user has any rights to it. diff -r adcc779985bd -r 38d89637aa23 src/plugins/acl/acl-mailbox-list.c --- a/src/plugins/acl/acl-mailbox-list.c Mon Nov 09 21:38:20 2009 -0500 +++ b/src/plugins/acl/acl-mailbox-list.c Tue Nov 10 19:12:51 2009 -0500 @@ -380,6 +380,24 @@ return ret; } +static int acl_mailbox_have_any_rights(struct mailbox_list *list, + const char *name) +{ + struct acl_mailbox_list *alist = ACL_LIST_CONTEXT(list); + struct acl_object *aclobj; + const char *const *rights; + int ret; + + aclobj = acl_object_init_from_name(alist->rights.backend, + list->ns->storage, name); + ret = acl_object_get_my_rights(aclobj, pool_datastack_create(), + &rights); + acl_object_deinit(&aclobj); + + return ret < 0 ? -1 : + (*rights == NULL ? 0 : 1); +} + static int acl_get_mailbox_name_status(struct mailbox_list *list, const char *name, enum mailbox_name_status *status) @@ -387,19 +405,9 @@ struct acl_mailbox_list *alist = ACL_LIST_CONTEXT(list); int ret; - ret = acl_mailbox_list_have_right(list, name, ACL_STORAGE_RIGHT_LOOKUP, - NULL); - if (ret < 0) - return -1; - if (ret == 0) { - /* If we have INSERT right for the mailbox, we'll need to - reveal its existence so that APPEND and COPY works. */ - ret = acl_mailbox_list_have_right(list, name, - ACL_STORAGE_RIGHT_INSERT, - NULL); - if (ret < 0) - return -1; - } + T_BEGIN { + ret = acl_mailbox_have_any_rights(list, name); + } T_END; if (alist->module_ctx.super.get_mailbox_name_status(list, name, status) < 0)