dovecot-2.1: lib-storage: Fixed setting usable/unusable flags fo...
dovecot at dovecot.org
dovecot at dovecot.org
Wed Apr 4 04:31:27 EEST 2012
details: http://hg.dovecot.org/dovecot-2.1/rev/4fe357d34faf
changeset: 14376:4fe357d34faf
user: Timo Sirainen <tss at iki.fi>
date: Wed Apr 04 04:31:09 2012 +0300
description:
lib-storage: Fixed setting usable/unusable flags for shared namespaces.
If a namespace doesn't have a root that exists, mark it as unusable.
This avoids ACL plugin from autocreating that directory.
diffstat:
src/lib-storage/index/shared/shared-storage.c | 19 ++++++++++++++++++-
1 files changed, 18 insertions(+), 1 deletions(-)
diffs (36 lines):
diff -r 411344f9daf3 -r 4fe357d34faf src/lib-storage/index/shared/shared-storage.c
--- a/src/lib-storage/index/shared/shared-storage.c Wed Apr 04 03:47:52 2012 +0300
+++ b/src/lib-storage/index/shared/shared-storage.c Wed Apr 04 04:31:09 2012 +0300
@@ -120,6 +120,19 @@
str_append(location, username);
}
+static bool shared_namespace_exists(struct mail_namespace *ns)
+{
+ const char *path;
+ struct stat st;
+
+ path = mailbox_list_get_path(ns->list, NULL, MAILBOX_LIST_PATH_TYPE_DIR);
+ if (path == NULL) {
+ /* we can't know if this exists */
+ return TRUE;
+ }
+ return stat(path, &st) == 0;
+}
+
int shared_storage_get_namespace(struct mail_namespace **_ns,
const char **_name)
{
@@ -310,7 +323,11 @@
mail_namespace_destroy(new_ns);
return -1;
}
- ns->flags |= NAMESPACE_FLAG_USABLE;
+ if ((new_ns->flags & NAMESPACE_FLAG_UNUSABLE) == 0 &&
+ !shared_namespace_exists(new_ns)) {
+ /* this user doesn't have a usable storage */
+ new_ns->flags |= NAMESPACE_FLAG_UNUSABLE;
+ }
*_name = mailbox_list_get_storage_name(new_ns->list,
t_strconcat(new_ns->prefix, name, NULL));
*_ns = new_ns;
More information about the dovecot-cvs
mailing list