changeset 9087:5a593a838f90 HEAD

Split NAMESPACE_FLAG_INTERNAL into distinct _NOQUOTA and _NOACL flags.
author Timo Sirainen <tss@iki.fi>
date Mon, 25 May 2009 23:39:03 -0400
parents c7db09d796b9
children 8eaa3476bdef
files src/deliver/deliver.c src/lib-storage/mail-namespace.c src/lib-storage/mail-namespace.h src/plugins/acl/acl-lookup-dict.c src/plugins/acl/acl-mailbox-list.c src/plugins/acl/acl-storage.c src/plugins/lazy-expunge/lazy-expunge-plugin.c src/plugins/quota/quota-storage.c
diffstat 8 files changed, 14 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/src/deliver/deliver.c	Mon May 25 23:33:56 2009 -0400
+++ b/src/deliver/deliver.c	Mon May 25 23:39:03 2009 -0400
@@ -1172,7 +1172,7 @@
 	raw_mail_user = mail_user_init(user);
 	mail_user_set_home(raw_mail_user, NULL);
 	raw_ns = mail_namespaces_init_empty(raw_mail_user);
-	raw_ns->flags |= NAMESPACE_FLAG_INTERNAL;
+	raw_ns->flags |= NAMESPACE_FLAG_NOQUOTA | NAMESPACE_FLAG_NOACL;
 
 	if (mail_storage_create(raw_ns, "raw", "/tmp",
 				MAIL_STORAGE_FLAG_FULL_FS_ACCESS,
--- a/src/lib-storage/mail-namespace.c	Mon May 25 23:33:56 2009 -0400
+++ b/src/lib-storage/mail-namespace.c	Mon May 25 23:39:03 2009 -0400
@@ -115,7 +115,7 @@
 
 	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;
--- a/src/lib-storage/mail-namespace.h	Mon May 25 23:33:56 2009 -0400
+++ b/src/lib-storage/mail-namespace.h	Mon May 25 23:39:03 2009 -0400
@@ -21,15 +21,17 @@
 	/* 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 {
--- a/src/plugins/acl/acl-lookup-dict.c	Mon May 25 23:33:56 2009 -0400
+++ b/src/plugins/acl/acl-lookup-dict.c	Mon May 25 23:39:03 2009 -0400
@@ -112,7 +112,7 @@
 	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);
--- a/src/plugins/acl/acl-mailbox-list.c	Mon May 25 23:33:56 2009 -0400
+++ b/src/plugins/acl/acl-mailbox-list.c	Mon May 25 23:39:03 2009 -0400
@@ -562,7 +562,7 @@
 
 void acl_mailbox_list_created(struct mailbox_list *list)
 {
-	if ((list->ns->flags & NAMESPACE_FLAG_INTERNAL) != 0) {
+	if ((list->ns->flags & NAMESPACE_FLAG_NOACL) != 0) {
 		/* no ACL checks for internal namespaces (deliver, shared) */
 		if (list->ns->type == NAMESPACE_SHARED)
 			acl_mailbox_list_init_shared(list);
--- a/src/plugins/acl/acl-storage.c	Mon May 25 23:33:56 2009 -0400
+++ b/src/plugins/acl/acl-storage.c	Mon May 25 23:39:03 2009 -0400
@@ -172,7 +172,7 @@
 	struct acl_mail_storage *astorage;
 	struct acl_backend *backend;
 
-	if ((storage->ns->flags & NAMESPACE_FLAG_INTERNAL) != 0) {
+	if ((storage->ns->flags & NAMESPACE_FLAG_NOACL) != 0) {
 		/* no ACL checks for internal namespaces (deliver) */
 	} else {
 		astorage = p_new(storage->pool, struct acl_mail_storage, 1);
--- a/src/plugins/lazy-expunge/lazy-expunge-plugin.c	Mon May 25 23:33:56 2009 -0400
+++ b/src/plugins/lazy-expunge/lazy-expunge-plugin.c	Mon May 25 23:39:03 2009 -0400
@@ -525,7 +525,7 @@
 	p = t_strsplit_spaces(getenv("LAZY_EXPUNGE"), " ");
 	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;
 		}
 	}
--- a/src/plugins/quota/quota-storage.c	Mon May 25 23:33:56 2009 -0400
+++ b/src/plugins/quota/quota-storage.c	Mon May 25 23:39:03 2009 -0400
@@ -557,7 +557,7 @@
 	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