dovecot-1.2: ACL: Handle shared namespaces.
dovecot at dovecot.org
dovecot at dovecot.org
Mon Sep 22 22:31:40 EEST 2008
details: http://hg.dovecot.org/dovecot-1.2/rev/909ed7cd98a5
changeset: 8212:909ed7cd98a5
user: Timo Sirainen <tss at iki.fi>
date: Mon Sep 22 22:31:33 2008 +0300
description:
ACL: Handle shared namespaces.
diffstat:
2 files changed, 15 insertions(+), 6 deletions(-)
src/plugins/acl/acl-backend-vfile-acllist.c | 13 ++++++++++---
src/plugins/acl/acl-backend-vfile.c | 8 +++++---
diffs (62 lines):
diff -r fd4091d53627 -r 909ed7cd98a5 src/plugins/acl/acl-backend-vfile-acllist.c
--- a/src/plugins/acl/acl-backend-vfile-acllist.c Mon Sep 22 22:31:13 2008 +0300
+++ b/src/plugins/acl/acl-backend-vfile-acllist.c Mon Sep 22 22:31:33 2008 +0300
@@ -51,6 +51,11 @@ static int acl_backend_vfile_acllist_rea
rootdir = mailbox_list_get_path(backend->backend.list, NULL,
MAILBOX_LIST_PATH_TYPE_DIR);
+ if (rootdir == NULL) {
+ /* we're never going to build acllist for this namespace. */
+ i_array_init(&backend->acllist, 1);
+ return 0;
+ }
path = t_strdup_printf("%s/"ACLLIST_FILENAME, rootdir);
if (backend->acllist_mtime != 0) {
@@ -191,16 +196,18 @@ int acl_backend_vfile_acllist_rebuild(st
gid_t gid;
int fd, ret;
- mailbox_list_get_permissions(list, &mode, &gid);
-
- path = t_str_new(256);
rootdir = mailbox_list_get_path(list, NULL,
MAILBOX_LIST_PATH_TYPE_DIR);
+ if (rootdir == NULL)
+ return 0;
+
+ path = t_str_new(256);
str_printfa(path, "%s/%s", rootdir, mailbox_list_get_temp_prefix(list));
/* Build it into a temporary file and rename() over. There's no need
to use locking, because even if multiple processes are rebuilding
the file at the same time the result should be the same. */
+ mailbox_list_get_permissions(list, &mode, &gid);
fd = safe_mkstemp(path, mode, (uid_t)-1, gid);
if (fd == -1) {
if (errno == EACCES) {
diff -r fd4091d53627 -r 909ed7cd98a5 src/plugins/acl/acl-backend-vfile.c
--- a/src/plugins/acl/acl-backend-vfile.c Mon Sep 22 22:31:13 2008 +0300
+++ b/src/plugins/acl/acl-backend-vfile.c Mon Sep 22 22:31:33 2008 +0300
@@ -143,7 +143,8 @@ acl_backend_vfile_object_init(struct acl
} else {
dir = acl_backend_vfile_get_local_dir(storage, name);
}
- aclobj->local_path = i_strconcat(dir, "/"ACL_FILENAME, NULL);
+ aclobj->local_path = dir == NULL ? NULL :
+ i_strconcat(dir, "/"ACL_FILENAME, NULL);
return &aclobj->aclobj;
}
@@ -208,8 +209,9 @@ acl_backend_vfile_has_acl(struct acl_bac
mailbox has no ACL it's equivalent to default ACLs. */
path = mailbox_list_get_path(storage->list, name,
MAILBOX_LIST_PATH_TYPE_MAILBOX);
- ret = acl_backend_vfile_exists(backend, path,
- &new_validity.mailbox_validity);
+ ret = path == NULL ? 0 :
+ acl_backend_vfile_exists(backend, path,
+ &new_validity.mailbox_validity);
if (ret == 0) {
dir = acl_backend_vfile_get_local_dir(storage, name);
local_path = t_strconcat(dir, "/", name, NULL);
More information about the dovecot-cvs
mailing list