]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
acl: Don't try to create dovecot-acl-list file for unknown users' auto-created namesp...
authorTimo Sirainen <tss@iki.fi>
Thu, 2 Apr 2009 23:09:32 +0000 (19:09 -0400)
committerTimo Sirainen <tss@iki.fi>
Thu, 2 Apr 2009 23:09:32 +0000 (19:09 -0400)
--HG--
branch : HEAD

src/lib-storage/index/shared/shared-storage.c
src/lib-storage/mail-namespace.h
src/plugins/acl/acl-backend-vfile-acllist.c

index c0e0826d6b5285f476c2e2e2bbfc2abe9ecb8e4f..a573aa0d391435f74a9346d665d6c454cd33b12e 100644 (file)
@@ -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",
index 1ccd59cb6136e366ee06a1b08b3cc892285311af..8073aa33ceedec53015e427648496815be5e600a 100644 (file)
@@ -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 {
index 862039eaf13483e8d18589b32c5711594e32cbc1..542c032001edbda2bd506426f8ba862b2167710a 100644 (file)
@@ -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 |