~ubuntu-branches/ubuntu/wily/dovecot/wily

« back to all changes in this revision

Viewing changes to src/plugins/acl/acl-mailbox-list.c

  • Committer: Bazaar Package Importer
  • Author(s): CHuck Short, Chuck Short
  • Date: 2009-11-06 00:47:29 UTC
  • mfrom: (4.1.9 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091106004729-i39n7v9e7d4h51f6
Tags: 1:1.2.6-1ubuntu1
* Merge from debian testing, remaining changes:
  Add new binary pkg dovecot-postfix that integrates postfix and dovecot
  automatically: (LP: #164837)
  + debian/control:
    - add new binary with short description
    - set Architecture all for dovecot-postfix (LP: #329878)
  + debian/dovecot-postfix.postinst:
    - create initial certificate symlinks to snakeoil.
    - set up postfix with postconf to:
      - use Maildir/ as the default mailbox.
      - use dovecot as the sasl authentication server.
      - use dovecot LDA (deliver).
      - use tls for smtp{d} services.
    - fix certificates paths in postfix' main.cf
    - add reject_unauth_destination to postfix' recipient restrictions
    - add reject_unknown_sender_domain to postfix' sender restrictions
    - rename configuration name on remove, delete on purge
    - restart dovecot after linking certificates
    - handle use case when postfix is unconfigurated
   + debian/dovecot-postfix.dirs: create backup directory for postfix's configuration
   + restart postfix and dovecot.
   + debian/dovecot-postfix.postrm:
     - remove all dovecot related configuration from postfix.
     - restart postfix and dovecot.
   + debian/dovecot-common.init:
     - check if /etc/dovecot/dovecot-postfix.conf exists and use it
       as the configuration file if so.
   + debian/patches/warning-ubuntu-postfix.dpatch
     - add warning about dovecot-postfix.conf in dovecot default 
       configuration file
   + debian/patches/dovecot-postfix.conf.diff:
     - Ubuntu server custom changes to the default dovecot configuration for
       better interfation with postfix
     - enable sieve plugin
   + debian/patches/dovecot-postfix.conf.diff:
     + Ubuntu server custom changes to the default dovecot configuration for
       better integration with postfix:
       - enable imap, pop3, imaps, pop3s and managesieve by default.
       - enable dovecot LDA (deliver).
       - enable SASL auth socket in postfix private directory.
   + debian/rules:
     - copy, patch and install dovecot-postfix.conf in /etc/dovecot/.
     - build architecure independent packages too
   + Use Snakeoil SSL certificates by default.
     - debian/control: Depend on ssl-cert.
     - debian/patches/ssl-cert-snakeoil.dpatch: Change default SSL cert
       paths to snakeoil.
     - debian/dovecot-common.postinst: Relax grep for SSL_* a bit.
   + Add autopkgtest to debian/tests/*.
   + Fast TearDown: Update the lsb init header to not stop in level 6.
   + Add ufw integration:
     - Created debian/dovecot-common.ufw.profile.
     - debian/rules:
       + install profile
     - debian/control:
       + Suggest ufw
   + debian/{control,rules}: enable PIE hardening.
   + dovecot-imapd, dovecot-pop3: Replaces dovecot-common (<< 1:1.1). LP: #254721
   + debian/control:
     - Update Vcs-* headers.
   + debian/rules:
     - Create emtpy stamp.h.in files in dovecot-sieve/ and dovecot-managesieve/
       if they're not there since empty files are not included in the diff.gz 
       file.
   + Add SMTP-AUTH support for Outlook (login auth mechanism)
   + Dropped:
     - debian/patches/security-CVE-2009-3235: Applied upstream.
     - debian/patches/fix-pop3-assertion.dpatch: Applied upstream.
     - dovecot-sieve and dovecot-managesieve: Use the debian patches instead.

  [Chuck Short]
  - Updated dovecot-sieve to 0.1.13.
  - Updated dovecot-managesieve to 0.11.9.

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
#include "mailbox-tree.h"
8
8
#include "mail-namespace.h"
9
9
#include "mailbox-list-private.h"
 
10
#include "acl-api-private.h"
10
11
#include "acl-cache.h"
11
 
#include "acl-api-private.h"
 
12
#include "acl-shared-storage.h"
12
13
#include "acl-plugin.h"
13
14
 
14
 
#include <stdlib.h>
15
 
 
16
15
#define ACL_LIST_CONTEXT(obj) \
17
16
        MODULE_CONTEXT(obj, acl_mailbox_list_module)
18
17
 
28
27
        struct mailbox_list_iterate_context ctx;
29
28
        struct mailbox_list_iterate_context *super_ctx;
30
29
 
31
 
        struct mailbox_tree_context *tree;
 
30
        struct mailbox_tree_context *lookup_boxes;
32
31
        struct mailbox_info info;
 
32
 
 
33
        struct imap_match_glob *glob;
 
34
        char sep;
 
35
        unsigned int simple_star_glob:1;
33
36
};
34
37
 
35
38
static MODULE_CONTEXT_DEFINE_INIT(acl_mailbox_list_module,
58
61
}
59
62
 
60
63
static void
61
 
acl_mailbox_try_list_fast(struct acl_mailbox_list_iterate_context *ctx,
62
 
                          const char *const *patterns)
 
64
acl_mailbox_try_list_fast(struct acl_mailbox_list_iterate_context *ctx)
63
65
{
64
66
        struct acl_mailbox_list *alist = ACL_LIST_CONTEXT(ctx->ctx.list);
65
67
        struct acl_backend *backend = alist->rights.backend;
66
 
        const unsigned int *idxp =
67
 
                alist->rights.acl_storage_right_idx + ACL_STORAGE_RIGHT_LOOKUP;
 
68
        const unsigned int *idxp;
68
69
        const struct acl_mask *acl_mask;
69
70
        struct acl_mailbox_list_context *nonowner_list_ctx;
70
71
        struct mail_namespace *ns = ctx->ctx.list->ns;
71
72
        struct mailbox_list_iter_update_context update_ctx;
72
73
        const char *name;
73
 
        string_t *vname;
74
 
        char sep;
75
 
        int try, ret;
 
74
        string_t *vname = NULL;
 
75
        int ret;
76
76
 
77
77
        if ((ctx->ctx.flags & (MAILBOX_LIST_ITER_RAW_LIST |
78
78
                               MAILBOX_LIST_ITER_SELECT_SUBSCRIBED)) != 0)
79
79
                return;
80
80
 
 
81
        if (ns->type == NAMESPACE_PUBLIC) {
 
82
                /* mailboxes in public namespace should all be listable to
 
83
                   someone. we don't benefit from fast listing. */
 
84
                return;
 
85
        }
 
86
 
 
87
        /* if this namespace's default rights contain LOOKUP, we'll need to
 
88
           go through all mailboxes in any case. */
 
89
        idxp = alist->rights.acl_storage_right_idx + ACL_STORAGE_RIGHT_LOOKUP;
81
90
        if (acl_backend_get_default_rights(backend, &acl_mask) < 0 ||
82
91
            acl_cache_mask_isset(acl_mask, *idxp))
83
92
                return;
84
93
 
85
 
        /* default is to not list mailboxes. we can optimize this. */
86
 
        if ((ctx->ctx.flags & MAILBOX_LIST_ITER_VIRTUAL_NAMES) != 0) {
87
 
                sep = ns->sep;
 
94
        /* no LOOKUP right by default, we can optimize this */
 
95
        if ((ctx->ctx.flags & MAILBOX_LIST_ITER_VIRTUAL_NAMES) != 0)
88
96
                vname = t_str_new(256);
89
 
        } else {
90
 
                sep = ns->real_sep;
91
 
                vname = NULL;
92
 
        }
93
97
 
94
98
        memset(&update_ctx, 0, sizeof(update_ctx));
95
99
        update_ctx.iter_ctx = &ctx->ctx;
96
100
        update_ctx.glob =
97
 
                imap_match_init_multiple(pool_datastack_create(), patterns,
98
 
                                         TRUE, sep);;
 
101
                imap_match_init(pool_datastack_create(), "*",
 
102
                                (ns->flags & NAMESPACE_FLAG_INBOX) != 0,
 
103
                                ctx->sep);
99
104
        update_ctx.match_parents = TRUE;
100
 
 
101
 
        for (try = 0; try < 2; try++) {
102
 
                nonowner_list_ctx =
103
 
                        acl_backend_nonowner_lookups_iter_init(backend);
104
 
                ctx->tree = mailbox_tree_init(sep);
105
 
                update_ctx.tree_ctx = ctx->tree;
106
 
 
107
 
                while ((ret = acl_backend_nonowner_lookups_iter_next(
108
 
                                        nonowner_list_ctx, &name)) > 0) {
109
 
                        if (vname != NULL) {
110
 
                                name = mail_namespace_get_vname(ns, vname,
111
 
                                                                name);
112
 
                        }
113
 
                        mailbox_list_iter_update(&update_ctx, name);
114
 
                }
115
 
                acl_backend_nonowner_lookups_iter_deinit(&nonowner_list_ctx);
116
 
 
117
 
                if (ret == 0)
118
 
                        break;
119
 
 
120
 
                /* try again */
121
 
                mailbox_tree_deinit(&ctx->tree);
 
105
        update_ctx.tree_ctx = mailbox_tree_init(ctx->sep);
 
106
 
 
107
        nonowner_list_ctx = acl_backend_nonowner_lookups_iter_init(backend);
 
108
        while ((ret = acl_backend_nonowner_lookups_iter_next(nonowner_list_ctx,
 
109
                                                             &name)) > 0) {
 
110
                if (vname != NULL)
 
111
                        name = mail_namespace_get_vname(ns, vname, name);
 
112
                mailbox_list_iter_update(&update_ctx, name);
122
113
        }
 
114
        acl_backend_nonowner_lookups_iter_deinit(&nonowner_list_ctx);
 
115
 
 
116
        if (ret == 0)
 
117
                ctx->lookup_boxes = update_ctx.tree_ctx;
 
118
        else
 
119
                mailbox_tree_deinit(&update_ctx.tree_ctx);
 
120
}
 
121
 
 
122
static struct mailbox_list_iterate_context *
 
123
acl_mailbox_list_iter_init_shared(struct mailbox_list *list,
 
124
                                  const char *const *patterns,
 
125
                                  enum mailbox_list_iter_flags flags)
 
126
{
 
127
        struct acl_mailbox_list *alist = ACL_LIST_CONTEXT(list);
 
128
        struct mailbox_list_iterate_context *ctx;
 
129
        int ret;
 
130
 
 
131
        /* before listing anything add namespaces for all users
 
132
           who may have visible mailboxes */
 
133
        ret = acl_shared_namespaces_add(list->ns);
 
134
 
 
135
        ctx = alist->module_ctx.super.iter_init(list, patterns, flags);
 
136
        if (ret < 0)
 
137
                ctx->failed = TRUE;
 
138
        return ctx;
123
139
}
124
140
 
125
141
static struct mailbox_list_iterate_context *
129
145
{
130
146
        struct acl_mailbox_list *alist = ACL_LIST_CONTEXT(list);
131
147
        struct acl_mailbox_list_iterate_context *ctx;
 
148
        const char *p;
 
149
        unsigned int i;
 
150
        bool inboxcase;
132
151
 
133
152
        ctx = i_new(struct acl_mailbox_list_iterate_context, 1);
134
153
        ctx->ctx.list = list;
135
154
        ctx->ctx.flags = flags;
136
155
 
 
156
        inboxcase = (list->ns->flags & NAMESPACE_FLAG_INBOX) != 0;
 
157
        ctx->sep = (ctx->ctx.flags & MAILBOX_LIST_ITER_VIRTUAL_NAMES) != 0 ?
 
158
                list->ns->sep : list->ns->real_sep;
 
159
        ctx->glob = imap_match_init_multiple(default_pool, patterns,
 
160
                                             inboxcase, ctx->sep);
 
161
        /* see if all patterns have only a single '*' and it's at the end.
 
162
           we can use it to do some optimizations. */
 
163
        ctx->simple_star_glob = TRUE;
 
164
        for (i = 0; patterns[i] != NULL; i++) {
 
165
                p = strchr(patterns[i], '*');
 
166
                if (p == NULL || p[1] != '\0') {
 
167
                        ctx->simple_star_glob = FALSE;
 
168
                        break;
 
169
                }
 
170
        }
 
171
 
 
172
        /* Try to avoid reading ACLs from all mailboxes by getting a smaller
 
173
           list of mailboxes that have even potential to be visible. If we
 
174
           couldn't get such a list, we'll go through all mailboxes. */
137
175
        T_BEGIN {
138
 
                acl_mailbox_try_list_fast(ctx, patterns);
 
176
                acl_mailbox_try_list_fast(ctx);
139
177
        } T_END;
140
178
        ctx->super_ctx = alist->module_ctx.super.
141
179
                iter_init(list, patterns, flags);
152
190
                info = alist->module_ctx.super.iter_next(ctx->super_ctx);
153
191
                if (info == NULL)
154
192
                        return NULL;
155
 
                /* if the mailbox isn't in shared mailboxes list, it's not
156
 
                   visible to us. */
157
 
        } while (ctx->tree != NULL &&
158
 
                 mailbox_tree_lookup(ctx->tree, info->name) == NULL);
 
193
                /* if we've a list of mailboxes with LOOKUP rights, skip the
 
194
                   mailboxes not in the list (since we know they can't be
 
195
                   visible to us). */
 
196
        } while (ctx->lookup_boxes != NULL &&
 
197
                 mailbox_tree_lookup(ctx->lookup_boxes, info->name) == NULL);
159
198
 
160
199
        return info;
161
200
}
176
215
        return mail_namespace_fix_sep(ns, name);
177
216
}
178
217
 
 
218
static bool
 
219
iter_is_listing_all_children(struct acl_mailbox_list_iterate_context *ctx)
 
220
{
 
221
        const char *child;
 
222
 
 
223
        /* If all patterns (with '.' separator) are in "name*", "name.*" or
 
224
           "%.*" style format, simple_star_glob=TRUE and we can easily test
 
225
           this by simply checking if name/child mailbox matches. */
 
226
        child = t_strdup_printf("%s%cx", ctx->info.name, ctx->sep);
 
227
        return ctx->simple_star_glob &&
 
228
                imap_match(ctx->glob, child) == IMAP_MATCH_YES;
 
229
}
 
230
 
 
231
static bool
 
232
iter_mailbox_has_visible_children(struct acl_mailbox_list_iterate_context *ctx,
 
233
                                  bool only_nonpatterns)
 
234
{
 
235
        struct mailbox_list_iterate_context *iter;
 
236
        const struct mailbox_info *info;
 
237
        enum mailbox_list_iter_flags flags;
 
238
        string_t *pattern;
 
239
        const char *prefix;
 
240
        unsigned int i, prefix_len;
 
241
        bool stars = FALSE, ret = FALSE;
 
242
 
 
243
        /* do we have child mailboxes with LOOKUP right that don't match
 
244
           the list pattern? */
 
245
        if (ctx->lookup_boxes != NULL) {
 
246
                /* we have a list of mailboxes with LOOKUP rights. before
 
247
                   starting the slow list iteration, check check first
 
248
                   if there even are any children with LOOKUP rights. */
 
249
                struct mailbox_node *node;
 
250
 
 
251
                node = mailbox_tree_lookup(ctx->lookup_boxes, ctx->info.name);
 
252
                i_assert(node != NULL);
 
253
                if (node->children == NULL)
 
254
                        return FALSE;
 
255
        }
 
256
 
 
257
        /* if mailbox name has '*' characters in it, they'll conflict with the
 
258
           LIST wildcard. replace then with '%' and verify later that all
 
259
           results have the correct prefix. */
 
260
        pattern = t_str_new(128);
 
261
        for (i = 0; ctx->info.name[i] != '\0'; i++) {
 
262
                if (ctx->info.name[i] != '*')
 
263
                        str_append_c(pattern, ctx->info.name[i]);
 
264
                else {
 
265
                        stars = TRUE;
 
266
                        str_append_c(pattern, '%');
 
267
                }
 
268
        }
 
269
        str_append_c(pattern, ctx->sep);
 
270
        str_append_c(pattern, '*');
 
271
        prefix = str_c(pattern);
 
272
        prefix_len = str_len(pattern) - 1;
 
273
 
 
274
        flags = (ctx->ctx.flags & MAILBOX_LIST_ITER_VIRTUAL_NAMES) |
 
275
                MAILBOX_LIST_ITER_RETURN_NO_FLAGS;
 
276
        iter = mailbox_list_iter_init(ctx->ctx.list, str_c(pattern), flags);
 
277
        while ((info = mailbox_list_iter_next(iter)) != NULL) {
 
278
                if (only_nonpatterns &&
 
279
                    imap_match(ctx->glob, info->name) == IMAP_MATCH_YES) {
 
280
                        /* at least one child matches also the original list
 
281
                           patterns. we don't need to show this mailbox. */
 
282
                        ret = FALSE;
 
283
                        break;
 
284
                }
 
285
                if (!stars || strncmp(info->name, prefix, prefix_len) == 0)
 
286
                        ret = TRUE;
 
287
        }
 
288
        (void)mailbox_list_iter_deinit(&iter);
 
289
        return ret;
 
290
}
 
291
 
179
292
static int
180
293
acl_mailbox_list_info_is_visible(struct acl_mailbox_list_iterate_context *ctx)
181
294
{
 
295
#define PRESERVE_MAILBOX_FLAGS (MAILBOX_SUBSCRIBED | MAILBOX_CHILD_SUBSCRIBED)
182
296
        struct mailbox_info *info = &ctx->info;
183
297
        const char *acl_name;
184
298
        int ret;
192
306
        ret = acl_mailbox_list_have_right(ctx->ctx.list, acl_name,
193
307
                                          ACL_STORAGE_RIGHT_LOOKUP,
194
308
                                          NULL);
195
 
        if (ret != 0)
 
309
        if (ret != 0) {
 
310
                if ((info->flags & MAILBOX_CHILDREN) != 0 &&
 
311
                    !iter_mailbox_has_visible_children(ctx, FALSE)) {
 
312
                        info->flags &= ~MAILBOX_CHILDREN;
 
313
                        info->flags |= MAILBOX_NOCHILDREN;
 
314
                }
196
315
                return ret;
 
316
        }
197
317
 
198
318
        /* no permission to see this mailbox */
199
 
        if ((info->flags & MAILBOX_SUBSCRIBED) != 0) {
200
 
                /* it's subscribed, show it as non-existent */
201
 
                info->flags = MAILBOX_NONEXISTENT | MAILBOX_SUBSCRIBED;
 
319
        if ((ctx->ctx.flags & MAILBOX_LIST_ITER_SELECT_SUBSCRIBED) != 0) {
 
320
                /* we're listing subscribed mailboxes. this one or its child
 
321
                   is subscribed, so we'll need to list it. but since we don't
 
322
                   have LOOKUP right, we'll need to show it as nonexistent. */
 
323
                i_assert((info->flags & PRESERVE_MAILBOX_FLAGS) != 0);
 
324
                info->flags = MAILBOX_NONEXISTENT |
 
325
                        (info->flags & PRESERVE_MAILBOX_FLAGS);
 
326
                return 1;
 
327
        }
 
328
 
 
329
        if (!iter_is_listing_all_children(ctx) &&
 
330
            iter_mailbox_has_visible_children(ctx, TRUE)) {
 
331
                /* no child mailboxes match the list pattern(s), but mailbox
 
332
                   has visible children. we'll need to show this as
 
333
                   non-existent. */
 
334
                info->flags = MAILBOX_NONEXISTENT | MAILBOX_CHILDREN |
 
335
                        (info->flags & PRESERVE_MAILBOX_FLAGS);
202
336
                return 1;
203
337
        }
204
338
        return 0;
229
363
}
230
364
 
231
365
static int
232
 
acl_mailbox_list_iter_is_mailbox(struct mailbox_list_iterate_context *ctx,
233
 
                                 const char *dir, const char *fname,
234
 
                                 const char *mailbox_name,
235
 
                                 enum mailbox_list_file_type type,
236
 
                                 enum mailbox_info_flags *flags_r)
237
 
{
238
 
        struct acl_mailbox_list *alist = ACL_LIST_CONTEXT(ctx->list);
239
 
        int ret;
240
 
 
241
 
        ret = alist->module_ctx.super.iter_is_mailbox(ctx, dir, fname,
242
 
                                                      mailbox_name,
243
 
                                                      type, flags_r);
244
 
        if (ret <= 0 || (ctx->flags & MAILBOX_LIST_ITER_RAW_LIST) != 0)
245
 
                return ret;
246
 
 
247
 
        mailbox_name = acl_mailbox_list_iter_get_name(ctx, mailbox_name);
248
 
        return acl_mailbox_list_have_right(ctx->list, mailbox_name,
249
 
                                           ACL_STORAGE_RIGHT_LOOKUP, NULL);
250
 
}
251
 
 
252
 
static int
253
366
acl_mailbox_list_iter_deinit(struct mailbox_list_iterate_context *_ctx)
254
367
{
255
368
        struct acl_mailbox_list_iterate_context *ctx =
259
372
 
260
373
        if (alist->module_ctx.super.iter_deinit(ctx->super_ctx) < 0)
261
374
                ret = -1;
262
 
        if (ctx->tree != NULL)
263
 
                mailbox_tree_deinit(&ctx->tree);
264
 
 
 
375
        if (ctx->lookup_boxes != NULL)
 
376
                mailbox_tree_deinit(&ctx->lookup_boxes);
 
377
        if (ctx->glob != NULL)
 
378
                imap_match_deinit(&ctx->glob);
265
379
        i_free(ctx);
266
380
        return ret;
267
381
}
392
506
        return alist->module_ctx.super.rename_mailbox(list, oldname, newname);
393
507
}
394
508
 
395
 
void acl_mailbox_list_created(struct mailbox_list *list)
396
 
{
 
509
static void acl_mailbox_list_init_shared(struct mailbox_list *list)
 
510
{
 
511
        struct acl_mailbox_list *alist;
 
512
 
 
513
        alist = p_new(list->pool, struct acl_mailbox_list, 1);
 
514
        alist->module_ctx.super = list->v;
 
515
        list->v.iter_init = acl_mailbox_list_iter_init_shared;
 
516
 
 
517
        MODULE_CONTEXT_SET(list, acl_mailbox_list_module, alist);
 
518
}
 
519
 
 
520
static void acl_mailbox_list_init_default(struct mailbox_list *list)
 
521
{
 
522
        struct acl_user *auser = ACL_USER_CONTEXT(list->ns->user);
397
523
        struct acl_mailbox_list *alist;
398
524
        struct acl_backend *backend;
399
525
        struct mail_namespace *ns;
400
526
        enum mailbox_list_flags flags;
401
 
        const char *acl_env, *current_username, *owner_username;
 
527
        const char *current_username, *owner_username;
402
528
        bool owner = TRUE;
403
529
 
404
 
        acl_env = getenv("ACL");
405
 
        i_assert(acl_env != NULL);
406
 
 
407
 
        owner_username = getenv("USER");
408
 
        if (owner_username == NULL)
409
 
                i_fatal("ACL: USER environment not set");
410
 
 
411
 
        current_username = getenv("MASTER_USER");
 
530
        owner_username = list->ns->user->username;
 
531
        current_username = auser->master_user;
412
532
        if (current_username == NULL)
413
533
                current_username = owner_username;
414
534
        else
421
541
        if (ns->type != NAMESPACE_PRIVATE)
422
542
                owner = FALSE;
423
543
 
424
 
        /* FIXME: set groups */
425
 
        backend = acl_backend_init(acl_env, list, current_username,
426
 
                                   getenv("ACL_GROUPS") == NULL ? NULL :
427
 
                                   t_strsplit(getenv("ACL_GROUPS"), ","),
428
 
                                   owner);
 
544
        backend = acl_backend_init(auser->acl_env, list, current_username,
 
545
                                   auser->groups, owner);
429
546
        if (backend == NULL)
430
547
                i_fatal("ACL backend initialization failed");
431
548
 
432
549
        flags = mailbox_list_get_flags(list);
433
550
        if ((flags & MAILBOX_LIST_FLAG_FULL_FS_ACCESS) != 0) {
434
 
                /* not necessarily, but safer to do this for now.. */
 
551
                /* not necessarily, but safer to do this for now. */
435
552
                i_fatal("mail_full_filesystem_access=yes is "
436
553
                        "incompatible with ACLs");
437
554
        }
441
558
        list->v.iter_init = acl_mailbox_list_iter_init;
442
559
        list->v.iter_next = acl_mailbox_list_iter_next;
443
560
        list->v.iter_deinit = acl_mailbox_list_iter_deinit;
444
 
        list->v.iter_is_mailbox = acl_mailbox_list_iter_is_mailbox;
445
561
        list->v.get_mailbox_name_status = acl_get_mailbox_name_status;
446
562
        list->v.delete_mailbox = acl_mailbox_list_delete;
447
563
        list->v.rename_mailbox = acl_mailbox_list_rename;
448
564
 
449
565
        acl_storage_rights_ctx_init(&alist->rights, backend);
450
 
 
451
566
        MODULE_CONTEXT_SET(list, acl_mailbox_list_module, alist);
 
567
}
 
568
 
 
569
void acl_mailbox_list_created(struct mailbox_list *list)
 
570
{
 
571
        if ((list->ns->flags & NAMESPACE_FLAG_NOACL) != 0) {
 
572
                /* no ACL checks for internal namespaces (deliver, shared) */
 
573
                if (list->ns->type == NAMESPACE_SHARED)
 
574
                        acl_mailbox_list_init_shared(list);
 
575
        } else {
 
576
                acl_mailbox_list_init_default(list);
 
577
        }
452
578
 
453
579
        if (acl_next_hook_mailbox_list_created != NULL)
454
580
                acl_next_hook_mailbox_list_created(list);