dovecot-2.0-sslstream: acl: mailbox_name_status() shouldn't hide...
dovecot at dovecot.org
dovecot at dovecot.org
Sat Feb 13 02:56:20 EET 2010
details: http://hg.dovecot.org/dovecot-2.0-sslstream/rev/9cf3caefec2c
changeset: 10306:9cf3caefec2c
user: Timo Sirainen <tss at iki.fi>
date: Tue Nov 10 18:57:14 2009 -0500
description:
acl: mailbox_name_status() shouldn't hide its existence if user has any rights to it.
diffstat:
1 file changed, 19 insertions(+), 13 deletions(-)
src/plugins/acl/acl-mailbox-list.c | 32 +++++++++++++++++++-------------
diffs (61 lines):
diff -r 0d659ac4656d -r 9cf3caefec2c src/plugins/acl/acl-mailbox-list.c
--- a/src/plugins/acl/acl-mailbox-list.c Tue Nov 10 18:35:49 2009 -0500
+++ b/src/plugins/acl/acl-mailbox-list.c Tue Nov 10 18:57:14 2009 -0500
@@ -57,11 +57,9 @@ int acl_mailbox_list_have_right(struct m
struct acl_mailbox_list *alist = ACL_LIST_CONTEXT(list);
struct acl_backend *backend = alist->rights.backend;
const unsigned int *idx_arr = alist->rights.acl_storage_right_idx;
- struct mail_namespace *ns;
struct acl_object *aclobj;
int ret, ret2;
- ns = mailbox_list_get_namespace(list);
aclobj = !parent ?
acl_object_init_from_name(backend, name) :
acl_object_init_from_parent(backend, name);
@@ -401,6 +399,22 @@ acl_mailbox_list_iter_deinit(struct mail
return ret;
}
+static int acl_mailbox_have_any_rights(struct acl_mailbox_list *alist,
+ const char *name)
+{
+ struct acl_object *aclobj;
+ const char *const *rights;
+ int ret;
+
+ aclobj = acl_object_init_from_name(alist->rights.backend, 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)
@@ -408,19 +422,11 @@ static int acl_get_mailbox_name_status(s
struct acl_mailbox_list *alist = ACL_LIST_CONTEXT(list);
int ret;
- ret = acl_mailbox_list_have_right(list, name, FALSE,
- ACL_STORAGE_RIGHT_LOOKUP, NULL);
+ T_BEGIN {
+ ret = acl_mailbox_have_any_rights(alist, name);
+ } T_END;
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, FALSE,
- ACL_STORAGE_RIGHT_INSERT,
- NULL);
- if (ret < 0)
- return -1;
- }
if (alist->module_ctx.super.get_mailbox_name_status(list, name,
status) < 0)
More information about the dovecot-cvs
mailing list