From 60b42c6dfdf9edcca8a96b380ef9a0adc60c2464 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Thu, 2 Apr 2009 19:09:32 -0400 Subject: [PATCH] acl: Don't try to create dovecot-acl-list file for unknown users' auto-created namespaces. --HG-- branch : HEAD --- src/lib-storage/index/shared/shared-storage.c | 4 +++- src/lib-storage/mail-namespace.h | 4 +++- src/plugins/acl/acl-backend-vfile-acllist.c | 7 ++++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/lib-storage/index/shared/shared-storage.c b/src/lib-storage/index/shared/shared-storage.c index c0e0826d6b..a573aa0d39 100644 --- a/src/lib-storage/index/shared/shared-storage.c +++ b/src/lib-storage/index/shared/shared-storage.c @@ -234,8 +234,10 @@ int shared_storage_get_namespace(struct mail_storage *_storage, location = t_str_new(256); if (ret > 0) var_expand(location, storage->location, tab); - else + else { get_nonexisting_user_location(storage, userdomain, location); + ns->flags |= NAMESPACE_FLAG_UNUSABLE; + } if (mail_storage_create(ns, NULL, str_c(location), _storage->flags, _storage->lock_method, &error) < 0) { mail_storage_set_critical(_storage, "Namespace '%s': %s", diff --git a/src/lib-storage/mail-namespace.h b/src/lib-storage/mail-namespace.h index 1ccd59cb61..8073aa33ce 100644 --- a/src/lib-storage/mail-namespace.h +++ b/src/lib-storage/mail-namespace.h @@ -27,7 +27,9 @@ enum namespace_flags { NAMESPACE_FLAG_AUTOCREATED = 0x2000, /* Namespace has at least some usable mailboxes. Autocreated namespaces that don't have usable mailboxes may be removed automatically. */ - NAMESPACE_FLAG_USABLE = 0x4000 + NAMESPACE_FLAG_USABLE = 0x4000, + /* Automatically created namespace for a user that doesn't exist. */ + NAMESPACE_FLAG_UNUSABLE = 0x8000 }; struct mail_namespace { diff --git a/src/plugins/acl/acl-backend-vfile-acllist.c b/src/plugins/acl/acl-backend-vfile-acllist.c index 862039eaf1..542c032001 100644 --- a/src/plugins/acl/acl-backend-vfile-acllist.c +++ b/src/plugins/acl/acl-backend-vfile-acllist.c @@ -185,6 +185,12 @@ int acl_backend_vfile_acllist_rebuild(struct acl_backend_vfile *backend) if (rootdir == NULL) return 0; + ns = mailbox_list_get_namespace(list); + if ((ns->flags & NAMESPACE_FLAG_UNUSABLE) != 0) { + /* we can't write anything here */ + return 0; + } + path = t_str_new(256); str_printfa(path, "%s/%s", rootdir, mailbox_list_get_temp_prefix(list)); @@ -206,7 +212,6 @@ int acl_backend_vfile_acllist_rebuild(struct acl_backend_vfile *backend) ret = 0; acllist_clear(backend, 0); - ns = mailbox_list_get_namespace(list); backend->rebuilding_acllist = TRUE; iter = mailbox_list_iter_init(list, "*", MAILBOX_LIST_ITER_RAW_LIST | -- 2.47.3