dovecot-2.0: Split NAMESPACE_FLAG_INTERNAL into distinct _NOQUOT...

dovecot at dovecot.org dovecot at dovecot.org
Tue May 26 06:41:21 EEST 2009


details:   http://hg.dovecot.org/dovecot-2.0/rev/e4429faabf59
changeset: 9374:e4429faabf59
user:      Timo Sirainen <tss at iki.fi>
date:      Mon May 25 23:41:12 2009 -0400
description:
Split NAMESPACE_FLAG_INTERNAL into distinct _NOQUOTA and _NOACL flags.

diffstat:

9 files changed, 15 insertions(+), 13 deletions(-)
src/lda/main.c                                 |    2 +-
src/lib-storage/mail-namespace.c               |    2 +-
src/lib-storage/mail-namespace.h               |   12 +++++++-----
src/lmtp/client.c                              |    2 +-
src/plugins/acl/acl-lookup-dict.c              |    2 +-
src/plugins/acl/acl-mailbox-list.c             |    2 +-
src/plugins/acl/acl-storage.c                  |    2 +-
src/plugins/lazy-expunge/lazy-expunge-plugin.c |    2 +-
src/plugins/quota/quota-storage.c              |    2 +-

diffs (122 lines):

diff -r ca2488181a2d -r e4429faabf59 src/lda/main.c
--- a/src/lda/main.c	Mon May 25 23:33:56 2009 -0400
+++ b/src/lda/main.c	Mon May 25 23:41:12 2009 -0400
@@ -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 -r ca2488181a2d -r e4429faabf59 src/lib-storage/mail-namespace.c
--- 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:41:12 2009 -0400
@@ -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 -r ca2488181a2d -r e4429faabf59 src/lib-storage/mail-namespace.h
--- 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:41:12 2009 -0400
@@ -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 -r ca2488181a2d -r e4429faabf59 src/lmtp/client.c
--- a/src/lmtp/client.c	Mon May 25 23:33:56 2009 -0400
+++ b/src/lmtp/client.c	Mon May 25 23:41:12 2009 -0400
@@ -134,7 +134,7 @@ static void client_raw_user_create(struc
 	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 -r ca2488181a2d -r e4429faabf59 src/plugins/acl/acl-lookup-dict.c
--- 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:41:12 2009 -0400
@@ -100,7 +100,7 @@ static int acl_lookup_dict_rebuild_add_b
 	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 -r ca2488181a2d -r e4429faabf59 src/plugins/acl/acl-mailbox-list.c
--- 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:41:12 2009 -0400
@@ -568,7 +568,7 @@ void acl_mailbox_list_created(struct mai
 
 	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 -r ca2488181a2d -r e4429faabf59 src/plugins/acl/acl-storage.c
--- 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:41:12 2009 -0400
@@ -175,7 +175,7 @@ void acl_mail_storage_created(struct mai
 
 	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 -r ca2488181a2d -r e4429faabf59 src/plugins/lazy-expunge/lazy-expunge-plugin.c
--- 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:41:12 2009 -0400
@@ -385,7 +385,7 @@ static void lazy_expunge_mail_storage_in
 	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 -r ca2488181a2d -r e4429faabf59 src/plugins/quota/quota-storage.c
--- 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:41:12 2009 -0400
@@ -555,7 +555,7 @@ void quota_mailbox_list_created(struct m
 	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


More information about the dovecot-cvs mailing list