Mercurial > dovecot > original-hg > dovecot-1.2
annotate src/plugins/acl/acl-storage.c @ 6429:65c69a53a7be HEAD
Replaced my Copyright notices. The year range always ends with 2007 now.
My name was replaced with "Dovecot authors". In many cases I didn't really
even own the copyright, so this is more correct.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sun, 16 Sep 2007 14:34:22 +0300 |
parents | f717fb4b31c0 |
children | 414c9d631a81 |
rev | line source |
---|---|
6429
65c69a53a7be
Replaced my Copyright notices. The year range always ends with 2007 now.
Timo Sirainen <tss@iki.fi>
parents:
5613
diff
changeset
|
1 /* Copyright (c) 2006-2007 Dovecot authors, see the included COPYING file */ |
4077
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
2 |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
3 #include "lib.h" |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
4 #include "array.h" |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
5 #include "istream.h" |
5540
1216c0ebe492
acl_backend is now tied to mailbox_list instead of mail_storage.
Timo Sirainen <tss@iki.fi>
parents:
5450
diff
changeset
|
6 #include "mail-namespace.h" |
5448
beabd433cdae
Moved delete/rename operations to mailbox_list API. Fixed mbox/maildir to
Timo Sirainen <tss@iki.fi>
parents:
4808
diff
changeset
|
7 #include "mailbox-list-private.h" |
5552
71b5fd371b9a
Create dovecot-acl-list file that lists all mailboxes where non-owner has
Timo Sirainen <tss@iki.fi>
parents:
5540
diff
changeset
|
8 #include "acl-api-private.h" |
4077
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
9 #include "acl-plugin.h" |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
10 |
5450
7a6db5ec047d
Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents:
5448
diff
changeset
|
11 struct acl_storage_module acl_storage_module = |
7a6db5ec047d
Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents:
5448
diff
changeset
|
12 MODULE_CONTEXT_INIT(&mail_storage_module_register); |
4077
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
13 |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
14 static const char *acl_storage_right_names[ACL_STORAGE_RIGHT_COUNT] = { |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
15 MAIL_ACL_LOOKUP, |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
16 MAIL_ACL_READ, |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
17 MAIL_ACL_WRITE, |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
18 MAIL_ACL_WRITE_SEEN, |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
19 MAIL_ACL_WRITE_DELETED, |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
20 MAIL_ACL_INSERT, |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
21 MAIL_ACL_EXPUNGE, |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
22 MAIL_ACL_CREATE, |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
23 MAIL_ACL_DELETE, |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
24 MAIL_ACL_ADMIN |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
25 }; |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
26 |
5540
1216c0ebe492
acl_backend is now tied to mailbox_list instead of mail_storage.
Timo Sirainen <tss@iki.fi>
parents:
5450
diff
changeset
|
27 void acl_storage_rights_ctx_init(struct acl_storage_rights_context *ctx, |
1216c0ebe492
acl_backend is now tied to mailbox_list instead of mail_storage.
Timo Sirainen <tss@iki.fi>
parents:
5450
diff
changeset
|
28 struct acl_backend *backend) |
4077
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
29 { |
5540
1216c0ebe492
acl_backend is now tied to mailbox_list instead of mail_storage.
Timo Sirainen <tss@iki.fi>
parents:
5450
diff
changeset
|
30 unsigned int i; |
1216c0ebe492
acl_backend is now tied to mailbox_list instead of mail_storage.
Timo Sirainen <tss@iki.fi>
parents:
5450
diff
changeset
|
31 |
1216c0ebe492
acl_backend is now tied to mailbox_list instead of mail_storage.
Timo Sirainen <tss@iki.fi>
parents:
5450
diff
changeset
|
32 ctx->backend = backend; |
1216c0ebe492
acl_backend is now tied to mailbox_list instead of mail_storage.
Timo Sirainen <tss@iki.fi>
parents:
5450
diff
changeset
|
33 for (i = 0; i < ACL_STORAGE_RIGHT_COUNT; i++) { |
1216c0ebe492
acl_backend is now tied to mailbox_list instead of mail_storage.
Timo Sirainen <tss@iki.fi>
parents:
5450
diff
changeset
|
34 ctx->acl_storage_right_idx[i] = |
1216c0ebe492
acl_backend is now tied to mailbox_list instead of mail_storage.
Timo Sirainen <tss@iki.fi>
parents:
5450
diff
changeset
|
35 acl_backend_lookup_right(backend, |
1216c0ebe492
acl_backend is now tied to mailbox_list instead of mail_storage.
Timo Sirainen <tss@iki.fi>
parents:
5450
diff
changeset
|
36 acl_storage_right_names[i]); |
1216c0ebe492
acl_backend is now tied to mailbox_list instead of mail_storage.
Timo Sirainen <tss@iki.fi>
parents:
5450
diff
changeset
|
37 } |
1216c0ebe492
acl_backend is now tied to mailbox_list instead of mail_storage.
Timo Sirainen <tss@iki.fi>
parents:
5450
diff
changeset
|
38 } |
1216c0ebe492
acl_backend is now tied to mailbox_list instead of mail_storage.
Timo Sirainen <tss@iki.fi>
parents:
5450
diff
changeset
|
39 |
1216c0ebe492
acl_backend is now tied to mailbox_list instead of mail_storage.
Timo Sirainen <tss@iki.fi>
parents:
5450
diff
changeset
|
40 int acl_storage_rights_ctx_have_right(struct acl_storage_rights_context *ctx, |
1216c0ebe492
acl_backend is now tied to mailbox_list instead of mail_storage.
Timo Sirainen <tss@iki.fi>
parents:
5450
diff
changeset
|
41 const char *name, |
1216c0ebe492
acl_backend is now tied to mailbox_list instead of mail_storage.
Timo Sirainen <tss@iki.fi>
parents:
5450
diff
changeset
|
42 unsigned int acl_storage_right_idx, |
1216c0ebe492
acl_backend is now tied to mailbox_list instead of mail_storage.
Timo Sirainen <tss@iki.fi>
parents:
5450
diff
changeset
|
43 bool *can_see_r) |
1216c0ebe492
acl_backend is now tied to mailbox_list instead of mail_storage.
Timo Sirainen <tss@iki.fi>
parents:
5450
diff
changeset
|
44 { |
1216c0ebe492
acl_backend is now tied to mailbox_list instead of mail_storage.
Timo Sirainen <tss@iki.fi>
parents:
5450
diff
changeset
|
45 const unsigned int *idx_arr = ctx->acl_storage_right_idx; |
1216c0ebe492
acl_backend is now tied to mailbox_list instead of mail_storage.
Timo Sirainen <tss@iki.fi>
parents:
5450
diff
changeset
|
46 struct mail_namespace *ns; |
4077
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
47 struct acl_object *aclobj; |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
48 int ret, ret2; |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
49 |
5540
1216c0ebe492
acl_backend is now tied to mailbox_list instead of mail_storage.
Timo Sirainen <tss@iki.fi>
parents:
5450
diff
changeset
|
50 ns = mailbox_list_get_namespace(ctx->backend->list); |
1216c0ebe492
acl_backend is now tied to mailbox_list instead of mail_storage.
Timo Sirainen <tss@iki.fi>
parents:
5450
diff
changeset
|
51 aclobj = acl_object_init_from_name(ctx->backend, ns->storage, name); |
4077
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
52 ret = acl_object_have_right(aclobj, idx_arr[acl_storage_right_idx]); |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
53 |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
54 if (can_see_r != NULL) { |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
55 ret2 = acl_object_have_right(aclobj, |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
56 idx_arr[ACL_STORAGE_RIGHT_LOOKUP]); |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
57 if (ret2 < 0) |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
58 ret = -1; |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
59 *can_see_r = ret2 > 0; |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
60 } |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
61 acl_object_deinit(&aclobj); |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
62 |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
63 return ret; |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
64 } |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
65 |
5540
1216c0ebe492
acl_backend is now tied to mailbox_list instead of mail_storage.
Timo Sirainen <tss@iki.fi>
parents:
5450
diff
changeset
|
66 static int |
1216c0ebe492
acl_backend is now tied to mailbox_list instead of mail_storage.
Timo Sirainen <tss@iki.fi>
parents:
5450
diff
changeset
|
67 acl_storage_have_right(struct mail_storage *storage, const char *name, |
1216c0ebe492
acl_backend is now tied to mailbox_list instead of mail_storage.
Timo Sirainen <tss@iki.fi>
parents:
5450
diff
changeset
|
68 unsigned int acl_storage_right_idx, bool *can_see_r) |
4077
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
69 { |
5540
1216c0ebe492
acl_backend is now tied to mailbox_list instead of mail_storage.
Timo Sirainen <tss@iki.fi>
parents:
5450
diff
changeset
|
70 struct acl_mail_storage *astorage = ACL_CONTEXT(storage); |
1216c0ebe492
acl_backend is now tied to mailbox_list instead of mail_storage.
Timo Sirainen <tss@iki.fi>
parents:
5450
diff
changeset
|
71 int ret; |
4077
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
72 |
5540
1216c0ebe492
acl_backend is now tied to mailbox_list instead of mail_storage.
Timo Sirainen <tss@iki.fi>
parents:
5450
diff
changeset
|
73 ret = acl_storage_rights_ctx_have_right(&astorage->rights, name, |
1216c0ebe492
acl_backend is now tied to mailbox_list instead of mail_storage.
Timo Sirainen <tss@iki.fi>
parents:
5450
diff
changeset
|
74 acl_storage_right_idx, |
1216c0ebe492
acl_backend is now tied to mailbox_list instead of mail_storage.
Timo Sirainen <tss@iki.fi>
parents:
5450
diff
changeset
|
75 can_see_r); |
1216c0ebe492
acl_backend is now tied to mailbox_list instead of mail_storage.
Timo Sirainen <tss@iki.fi>
parents:
5450
diff
changeset
|
76 if (ret < 0) |
1216c0ebe492
acl_backend is now tied to mailbox_list instead of mail_storage.
Timo Sirainen <tss@iki.fi>
parents:
5450
diff
changeset
|
77 mail_storage_set_internal_error(storage); |
1216c0ebe492
acl_backend is now tied to mailbox_list instead of mail_storage.
Timo Sirainen <tss@iki.fi>
parents:
5450
diff
changeset
|
78 return ret; |
4077
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
79 } |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
80 |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
81 static void acl_storage_destroy(struct mail_storage *storage) |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
82 { |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
83 struct acl_mail_storage *astorage = ACL_CONTEXT(storage); |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
84 |
5540
1216c0ebe492
acl_backend is now tied to mailbox_list instead of mail_storage.
Timo Sirainen <tss@iki.fi>
parents:
5450
diff
changeset
|
85 acl_backend_deinit(&astorage->rights.backend); |
1216c0ebe492
acl_backend is now tied to mailbox_list instead of mail_storage.
Timo Sirainen <tss@iki.fi>
parents:
5450
diff
changeset
|
86 if (astorage->module_ctx.super.destroy != NULL) |
1216c0ebe492
acl_backend is now tied to mailbox_list instead of mail_storage.
Timo Sirainen <tss@iki.fi>
parents:
5450
diff
changeset
|
87 astorage->module_ctx.super.destroy(storage); |
4077
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
88 } |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
89 |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
90 static struct mailbox * |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
91 acl_mailbox_open(struct mail_storage *storage, const char *name, |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
92 struct istream *input, enum mailbox_open_flags flags) |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
93 { |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
94 struct acl_mail_storage *astorage = ACL_CONTEXT(storage); |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
95 struct mailbox *box; |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
96 bool can_see; |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
97 int ret; |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
98 |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
99 /* mailbox can be opened either for reading or appending new messages */ |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
100 if ((flags & MAILBOX_OPEN_SAVEONLY) != 0) { |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
101 ret = acl_storage_have_right(storage, name, |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
102 ACL_STORAGE_RIGHT_INSERT, |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
103 &can_see); |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
104 } else { |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
105 ret = acl_storage_have_right(storage, name, |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
106 ACL_STORAGE_RIGHT_READ, |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
107 &can_see); |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
108 } |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
109 if (ret <= 0) { |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
110 if (ret < 0) |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
111 return NULL; |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
112 if (can_see) { |
5613 | 113 mail_storage_set_error(storage, MAIL_ERROR_PERM, |
114 MAIL_ERRSTR_NO_PERMISSION); | |
4077
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
115 } else { |
5613 | 116 mail_storage_set_error(storage, MAIL_ERROR_NOTFOUND, |
117 T_MAIL_ERR_MAILBOX_NOT_FOUND(name)); | |
4077
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
118 } |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
119 return NULL; |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
120 } |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
121 |
5450
7a6db5ec047d
Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents:
5448
diff
changeset
|
122 box = astorage->module_ctx.super. |
7a6db5ec047d
Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents:
5448
diff
changeset
|
123 mailbox_open(storage, name, input, flags); |
4077
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
124 if (box == NULL) |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
125 return NULL; |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
126 |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
127 return acl_mailbox_open_box(box); |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
128 } |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
129 |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
130 static int acl_mailbox_create(struct mail_storage *storage, const char *name, |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
131 bool directory) |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
132 { |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
133 struct acl_mail_storage *astorage = ACL_CONTEXT(storage); |
5540
1216c0ebe492
acl_backend is now tied to mailbox_list instead of mail_storage.
Timo Sirainen <tss@iki.fi>
parents:
5450
diff
changeset
|
134 struct mailbox_list *list = mail_storage_get_list(storage); |
4077
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
135 int ret; |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
136 |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
137 t_push(); |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
138 ret = acl_storage_have_right(storage, |
5540
1216c0ebe492
acl_backend is now tied to mailbox_list instead of mail_storage.
Timo Sirainen <tss@iki.fi>
parents:
5450
diff
changeset
|
139 acl_mailbox_list_get_parent_mailbox_name(list, name), |
4808
93bc9770f938
Initial code for separation of mailbox accessing and directory layout
Timo Sirainen <tss@iki.fi>
parents:
4083
diff
changeset
|
140 ACL_STORAGE_RIGHT_CREATE, NULL); |
4077
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
141 t_pop(); |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
142 |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
143 if (ret <= 0) { |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
144 if (ret == 0) { |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
145 /* Note that if the mailbox didn't have LOOKUP |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
146 permission, this not reveals to user the mailbox's |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
147 existence. Can't help it. */ |
5613 | 148 mail_storage_set_error(storage, MAIL_ERROR_PERM, |
149 MAIL_ERRSTR_NO_PERMISSION); | |
4077
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
150 } |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
151 return -1; |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
152 } |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
153 |
5450
7a6db5ec047d
Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents:
5448
diff
changeset
|
154 return astorage->module_ctx.super. |
7a6db5ec047d
Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents:
5448
diff
changeset
|
155 mailbox_create(storage, name, directory); |
4077
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
156 } |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
157 |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
158 void acl_mail_storage_created(struct mail_storage *storage) |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
159 { |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
160 struct acl_mail_storage *astorage; |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
161 struct acl_backend *backend; |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
162 |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
163 if (acl_next_hook_mail_storage_created != NULL) |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
164 acl_next_hook_mail_storage_created(storage); |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
165 |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
166 astorage = p_new(storage->pool, struct acl_mail_storage, 1); |
5450
7a6db5ec047d
Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents:
5448
diff
changeset
|
167 astorage->module_ctx.super = storage->v; |
4077
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
168 storage->v.destroy = acl_storage_destroy; |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
169 storage->v.mailbox_open = acl_mailbox_open; |
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
170 storage->v.mailbox_create = acl_mailbox_create; |
4808
93bc9770f938
Initial code for separation of mailbox accessing and directory layout
Timo Sirainen <tss@iki.fi>
parents:
4083
diff
changeset
|
171 |
5540
1216c0ebe492
acl_backend is now tied to mailbox_list instead of mail_storage.
Timo Sirainen <tss@iki.fi>
parents:
5450
diff
changeset
|
172 backend = acl_mailbox_list_get_backend(mail_storage_get_list(storage)); |
1216c0ebe492
acl_backend is now tied to mailbox_list instead of mail_storage.
Timo Sirainen <tss@iki.fi>
parents:
5450
diff
changeset
|
173 acl_storage_rights_ctx_init(&astorage->rights, backend); |
4077
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
174 |
5450
7a6db5ec047d
Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents:
5448
diff
changeset
|
175 MODULE_CONTEXT_SET(storage, acl_storage_module, astorage); |
4077
73573b9ecb00
Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff
changeset
|
176 } |
4808
93bc9770f938
Initial code for separation of mailbox accessing and directory layout
Timo Sirainen <tss@iki.fi>
parents:
4083
diff
changeset
|
177 |