From: Timo Sirainen Date: Mon, 19 Jun 2017 08:30:27 +0000 (+0300) Subject: acl: Add acl_globals_only setting X-Git-Tag: 2.3.0.rc1~1393 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5714c480bb705939ef33de2ec7e8fb501809aa49;p=thirdparty%2Fdovecot%2Fcore.git acl: Add acl_globals_only setting The local dovecot-acl files aren't even attempted to be looked up if this is set. This is mainly useful to avoid unnecessary stat()s to dovecot-acl files that never exist. --- diff --git a/src/plugins/acl/acl-api-private.h b/src/plugins/acl/acl-api-private.h index e1aeac94f0..6859779df3 100644 --- a/src/plugins/acl/acl-api-private.h +++ b/src/plugins/acl/acl-api-private.h @@ -59,6 +59,7 @@ struct acl_backend { bool owner:1; bool debug:1; + bool globals_only:1; }; struct acl_mailbox_list_context { diff --git a/src/plugins/acl/acl-backend-vfile.c b/src/plugins/acl/acl-backend-vfile.c index 9fb1798b60..5809d09876 100644 --- a/src/plugins/acl/acl-backend-vfile.c +++ b/src/plugins/acl/acl-backend-vfile.c @@ -112,6 +112,9 @@ acl_backend_vfile_get_local_dir(struct acl_backend *backend, if (*name == '\0') name = NULL; + if (backend->globals_only) + return NULL; + /* ACL files are very important. try to keep them among the main mail files. that's not possible though with a) if the mailbox is a file or b) if the mailbox path doesn't point to filesystem. */ diff --git a/src/plugins/acl/acl-backend.c b/src/plugins/acl/acl-backend.c index ab22b67587..cece50d17c 100644 --- a/src/plugins/acl/acl-backend.c +++ b/src/plugins/acl/acl-backend.c @@ -175,6 +175,8 @@ struct acl_object *acl_backend_get_default_object(struct acl_backend *backend) ns->type == MAIL_NAMESPACE_TYPE_SHARED) default_name = "INBOX"; } + backend->globals_only = + mail_user_plugin_getenv_bool(user, "acl_globals_only"); backend->default_aclobj = acl_object_init_from_name(backend, default_name); return backend->default_aclobj;