1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
|
/* Copyright (c) 2003-2018 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "mail-storage-private.h"
#include "mailbox-attribute-internal.h"
/*
* Internal mailbox attributes
*/
/* /private/specialuse (RFC 6154) */
static int
mailbox_attribute_specialuse_get(struct mailbox *box,
const char *key ATTR_UNUSED,
struct mail_attribute_value *value_r)
{
const struct mailbox_settings *set = box->set;
if (set == NULL || *set->special_use == '\0')
return 0;
value_r->value = set->special_use;
return 1;
}
static struct mailbox_attribute_internal
iattr_mbox_prv_special_use = {
.type = MAIL_ATTRIBUTE_TYPE_PRIVATE,
.key = MAILBOX_ATTRIBUTE_SPECIALUSE,
.rank = MAIL_ATTRIBUTE_INTERNAL_RANK_AUTHORITY,
.flags = MAIL_ATTRIBUTE_INTERNAL_FLAG_VALIDATED,
.get = mailbox_attribute_specialuse_get
};
/* /private/comment, /shared/comment (RFC 5464) */
static int
mailbox_attribute_comment_get(struct mailbox *box,
const char *key ATTR_UNUSED,
struct mail_attribute_value *value_r)
{
const struct mailbox_settings *set = box->set;
if (set == NULL || *set->comment == '\0')
return 0;
value_r->value = set->comment;
return 1;
}
static struct mailbox_attribute_internal
iattr_mbox_prv_comment = {
.type = MAIL_ATTRIBUTE_TYPE_PRIVATE,
.key = MAILBOX_ATTRIBUTE_COMMENT,
.rank = MAIL_ATTRIBUTE_INTERNAL_RANK_DEFAULT,
.get = mailbox_attribute_comment_get
};
static struct mailbox_attribute_internal
iattr_mbox_shd_comment = {
.type = MAIL_ATTRIBUTE_TYPE_SHARED,
.key = MAILBOX_ATTRIBUTE_COMMENT,
.rank = MAIL_ATTRIBUTE_INTERNAL_RANK_DEFAULT,
.get = mailbox_attribute_comment_get
};
/*
* Internal server attributes
*/
/* /shared/comment (RFC 5464) */
static int
server_attribute_comment_get(struct mailbox *box,
const char *key ATTR_UNUSED,
struct mail_attribute_value *value_r)
{
const struct mail_storage_settings *set = box->storage->set;
if (*set->mail_server_comment == '\0')
return 0;
value_r->value = set->mail_server_comment;
return 1;
}
static struct mailbox_attribute_internal
iattr_serv_shd_comment = {
.type = MAIL_ATTRIBUTE_TYPE_SHARED,
.key = MAILBOX_ATTRIBUTE_PREFIX_DOVECOT_PVT_SERVER
MAIL_SERVER_ATTRIBUTE_COMMENT,
.rank = MAIL_ATTRIBUTE_INTERNAL_RANK_AUTHORITY,
.get = server_attribute_comment_get
};
/* /shared/admin (RFC 5464) */
static int
server_attribute_admin_get(struct mailbox *box,
const char *key ATTR_UNUSED,
struct mail_attribute_value *value_r)
{
const struct mail_storage_settings *set = box->storage->set;
if (*set->mail_server_admin == '\0')
return 0;
value_r->value = set->mail_server_admin;
return 1;
}
static struct mailbox_attribute_internal
iattr_serv_shd_admin = {
.type = MAIL_ATTRIBUTE_TYPE_SHARED,
.key = MAILBOX_ATTRIBUTE_PREFIX_DOVECOT_PVT_SERVER
MAIL_SERVER_ATTRIBUTE_ADMIN,
.rank = MAIL_ATTRIBUTE_INTERNAL_RANK_AUTHORITY,
.get = server_attribute_admin_get
};
/*
* Registry
*/
void mailbox_attributes_internal_init(void)
{
/*
* Internal mailbox attributes
*/
/* /private/specialuse (RFC 6154) */
mailbox_attribute_register_internal(&iattr_mbox_prv_special_use);
/* /private/comment (RFC 5464) */
mailbox_attribute_register_internal(&iattr_mbox_prv_comment);
/* /shared/comment (RFC 5464) */
mailbox_attribute_register_internal(&iattr_mbox_shd_comment);
/*
* internal server attributes
*/
/* /shared/comment (RFC 5464) */
mailbox_attribute_register_internal(&iattr_serv_shd_comment);
/* /shared/admin (RFC 5464) */
mailbox_attribute_register_internal(&iattr_serv_shd_admin);
}
|