Mercurial > dovecot > core-2.2
changeset 5047:e92b4ad15b70 HEAD
Moved dovecot-acl file from control dir to mail directory, except with
mboxes. If the file still exists in control dir, Dovecot kills itself
(rather than give full access to the mailbox).
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Fri, 19 Jan 2007 23:59:12 +0200 |
parents | f2cc68a3a198 |
children | 5c0a5cf4626d |
files | src/plugins/acl/acl-backend-vfile.c |
diffstat | 1 files changed, 23 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/plugins/acl/acl-backend-vfile.c Fri Jan 19 23:19:49 2007 +0200 +++ b/src/plugins/acl/acl-backend-vfile.c Fri Jan 19 23:59:12 2007 +0200 @@ -103,18 +103,35 @@ struct acl_backend_vfile *backend = (struct acl_backend_vfile *)_backend; struct acl_object_vfile *aclobj; - const char *control_dir; - - control_dir = - mail_storage_get_mailbox_control_dir(_backend->storage, name); + const char *control_dir, *dir; + bool is_file; aclobj = i_new(struct acl_object_vfile, 1); aclobj->aclobj.backend = _backend; aclobj->aclobj.name = i_strdup(name); aclobj->global_path = *backend->global_dir == '\0' ? NULL : i_strconcat(backend->global_dir, "/", name, NULL); - aclobj->local_path = - i_strconcat(control_dir, "/"ACL_FILENAME, NULL); + + control_dir = + mail_storage_get_mailbox_control_dir(_backend->storage, name); + dir = mail_storage_get_mailbox_path(_backend->storage, name, &is_file); + if (is_file) { + /* use control directory with mboxes */ + dir = control_dir; + } else { + /* FIXME: this is only for making sure people won't upgrade + improperly. remove this check some day. */ + const char *path; + struct stat st; + + path = t_strconcat(control_dir, "/"ACL_FILENAME, NULL); + if (stat(path, &st) == 0) { + i_fatal("%s is no longer kept in control directory, " + "move it to the actual maildir (%s)", + path, dir); + } + } + aclobj->local_path = i_strconcat(dir, "/"ACL_FILENAME, NULL); return &aclobj->aclobj; }