From: Timo Sirainen Date: Tue, 26 May 2009 03:41:12 +0000 (-0400) Subject: Split NAMESPACE_FLAG_INTERNAL into distinct _NOQUOTA and _NOACL flags. X-Git-Tag: 2.0.alpha1~678 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=16db188cfddce117500a161302f17ae691b4500e;p=thirdparty%2Fdovecot%2Fcore.git Split NAMESPACE_FLAG_INTERNAL into distinct _NOQUOTA and _NOACL flags. --HG-- branch : HEAD --- diff --git a/src/lda/main.c b/src/lda/main.c index 4ae61a022b..7f021fcaf9 100644 --- a/src/lda/main.c +++ b/src/lda/main.c @@ -410,7 +410,7 @@ int main(int argc, char *argv[]) raw_ns_set.location = "/tmp"; raw_ns = mail_namespaces_init_empty(raw_mail_user); - raw_ns->flags |= NAMESPACE_FLAG_INTERNAL; + raw_ns->flags |= NAMESPACE_FLAG_NOQUOTA | NAMESPACE_FLAG_NOACL; raw_ns->set = &raw_ns_set; if (mail_storage_create(raw_ns, "raw", 0, &errstr) < 0) i_fatal("Couldn't create internal raw storage: %s", errstr); diff --git a/src/lib-storage/mail-namespace.c b/src/lib-storage/mail-namespace.c index 78a4027140..f32a0ce1fa 100644 --- a/src/lib-storage/mail-namespace.c +++ b/src/lib-storage/mail-namespace.c @@ -120,7 +120,7 @@ namespace_add(struct mail_user *user, if (ns->type == NAMESPACE_SHARED && strchr(ns->prefix, '%') != NULL) { /* dynamic shared namespace */ - ns->flags |= NAMESPACE_FLAG_INTERNAL; + ns->flags |= NAMESPACE_FLAG_NOQUOTA | NAMESPACE_FLAG_NOACL; driver = "shared"; } else { driver = NULL; diff --git a/src/lib-storage/mail-namespace.h b/src/lib-storage/mail-namespace.h index f57ba7e727..b95c454879 100644 --- a/src/lib-storage/mail-namespace.h +++ b/src/lib-storage/mail-namespace.h @@ -21,15 +21,17 @@ enum namespace_flags { /* Namespace uses its own subscriptions. */ NAMESPACE_FLAG_SUBSCRIPTIONS = 0x10, - /* Namespace is created for internal use only. */ - NAMESPACE_FLAG_INTERNAL = 0x1000, /* Namespace was created automatically (for shared mailboxes) */ - NAMESPACE_FLAG_AUTOCREATED = 0x2000, + NAMESPACE_FLAG_AUTOCREATED = 0x1000, /* 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 = 0x2000, /* Automatically created namespace for a user that doesn't exist. */ - NAMESPACE_FLAG_UNUSABLE = 0x8000 + NAMESPACE_FLAG_UNUSABLE = 0x4000, + /* Don't track quota for this namespace */ + NAMESPACE_FLAG_NOQUOTA = 0x8000, + /* Don't enforce ACLs for this namespace */ + NAMESPACE_FLAG_NOACL = 0x10000 }; struct mail_namespace { diff --git a/src/lmtp/client.c b/src/lmtp/client.c index a11e3c2b8b..6ee08a64d0 100644 --- a/src/lmtp/client.c +++ b/src/lmtp/client.c @@ -134,7 +134,7 @@ static void client_raw_user_create(struct client *client) raw_ns_set.location = "/tmp"; raw_ns = mail_namespaces_init_empty(client->raw_mail_user); - raw_ns->flags |= NAMESPACE_FLAG_INTERNAL; + raw_ns->flags |= NAMESPACE_FLAG_NOQUOTA | NAMESPACE_FLAG_NOACL; raw_ns->set = &raw_ns_set; if (mail_storage_create(raw_ns, "raw", 0, &error) < 0) i_fatal("Couldn't create internal raw storage: %s", error); diff --git a/src/plugins/acl/acl-lookup-dict.c b/src/plugins/acl/acl-lookup-dict.c index 3e5b871ae4..acba4e0946 100644 --- a/src/plugins/acl/acl-lookup-dict.c +++ b/src/plugins/acl/acl-lookup-dict.c @@ -100,7 +100,7 @@ static int acl_lookup_dict_rebuild_add_backend(struct mail_namespace *ns, string_t *id; int ret, ret2 = 0; - if ((ns->flags & NAMESPACE_FLAG_INTERNAL) != 0 || ns->owner == NULL) + if ((ns->flags & NAMESPACE_FLAG_NOACL) != 0 || ns->owner == NULL) return 0; id = t_str_new(128); diff --git a/src/plugins/acl/acl-mailbox-list.c b/src/plugins/acl/acl-mailbox-list.c index d0405a868d..ea22183888 100644 --- a/src/plugins/acl/acl-mailbox-list.c +++ b/src/plugins/acl/acl-mailbox-list.c @@ -568,7 +568,7 @@ void acl_mailbox_list_created(struct mailbox_list *list) if (auser == NULL) { /* ACLs disabled for this user */ - } else if ((list->ns->flags & NAMESPACE_FLAG_INTERNAL) != 0) { + } else if ((list->ns->flags & NAMESPACE_FLAG_NOACL) != 0) { /* no ACL checks for internal namespaces (lda, shared) */ if (list->ns->type == NAMESPACE_SHARED) acl_mailbox_list_init_shared(list); diff --git a/src/plugins/acl/acl-storage.c b/src/plugins/acl/acl-storage.c index effabea656..626d1c48b3 100644 --- a/src/plugins/acl/acl-storage.c +++ b/src/plugins/acl/acl-storage.c @@ -175,7 +175,7 @@ void acl_mail_storage_created(struct mail_storage *storage) if (auser == NULL) { /* ACLs disabled for this user */ - } else if ((storage->ns->flags & NAMESPACE_FLAG_INTERNAL) != 0) { + } else if ((storage->ns->flags & NAMESPACE_FLAG_NOACL) != 0) { /* no ACL checks for internal namespaces (lda) */ } else { astorage = p_new(storage->pool, struct acl_mail_storage, 1); diff --git a/src/plugins/lazy-expunge/lazy-expunge-plugin.c b/src/plugins/lazy-expunge/lazy-expunge-plugin.c index 014a8e2490..c697c0d6eb 100644 --- a/src/plugins/lazy-expunge/lazy-expunge-plugin.c +++ b/src/plugins/lazy-expunge/lazy-expunge-plugin.c @@ -385,7 +385,7 @@ static void lazy_expunge_mail_storage_init(struct mail_storage *storage) p = t_strsplit_spaces(luser->env, " "); for (i = 0; i < LAZY_NAMESPACE_COUNT; i++, p++) { if (strcmp(storage->ns->prefix, *p) == 0) { - storage->ns->flags |= NAMESPACE_FLAG_INTERNAL; + storage->ns->flags |= NAMESPACE_FLAG_NOQUOTA; break; } } diff --git a/src/plugins/quota/quota-storage.c b/src/plugins/quota/quota-storage.c index 2314bb5989..a8e6333e89 100644 --- a/src/plugins/quota/quota-storage.c +++ b/src/plugins/quota/quota-storage.c @@ -555,7 +555,7 @@ void quota_mailbox_list_created(struct mailbox_list *list) struct quota_root *root; bool add; - if ((list->ns->flags & NAMESPACE_FLAG_INTERNAL) != 0) + if ((list->ns->flags & NAMESPACE_FLAG_NOQUOTA) != 0) add = FALSE; else if (list->ns->owner == NULL) { /* see if we have a quota explicitly defined for