dovecot-2.0: lib-storage: Fixed using "auto" driver with shared ...
dovecot at dovecot.org
dovecot at dovecot.org
Wed Nov 16 19:42:26 EET 2011
details: http://hg.dovecot.org/dovecot-2.0/rev/18078d6cce84
changeset: 12970:18078d6cce84
user: Timo Sirainen <tss at iki.fi>
date: Wed Nov 16 19:39:33 2011 +0200
description:
lib-storage: Fixed using "auto" driver with shared namespaces.
diffstat:
src/lib-storage/index/shared/shared-storage.c | 14 ++++++++++----
src/lib-storage/index/shared/shared-storage.h | 2 +-
2 files changed, 11 insertions(+), 5 deletions(-)
diffs (61 lines):
diff -r 95b08f167d68 -r 18078d6cce84 src/lib-storage/index/shared/shared-storage.c
--- a/src/lib-storage/index/shared/shared-storage.c Wed Nov 16 19:39:18 2011 +0200
+++ b/src/lib-storage/index/shared/shared-storage.c Wed Nov 16 19:39:33 2011 +0200
@@ -31,6 +31,7 @@
const char **error_r)
{
struct shared_storage *storage = (struct shared_storage *)_storage;
+ struct mail_storage *storage_class;
const char *driver, *p;
char *wildcardp, key;
bool have_username;
@@ -45,13 +46,14 @@
storage->location = p_strdup(_storage->pool, ns->set->location);
storage->unexpanded_location =
p_strdup(_storage->pool, ns->unexpanded_set->location);
- storage->storage_class = mail_storage_find_class(driver);
- if (storage->storage_class == NULL) {
+ storage_class = mail_storage_find_class(driver);
+ if (storage_class != NULL)
+ _storage->class_flags = storage_class->class_flags;
+ else if (strcmp(driver, "auto") != 0) {
*error_r = t_strconcat("Unknown shared storage driver: ",
driver, NULL);
return -1;
}
- _storage->class_flags = storage->storage_class->class_flags;
wildcardp = strchr(ns->prefix, '%');
if (wildcardp == NULL) {
@@ -106,7 +108,7 @@
{
/* user wasn't found. we'll still need to create the storage
to avoid exposing which users exist and which don't. */
- str_append(location, storage->storage_class->name);
+ str_append(location, storage->storage_class_name);
str_append_c(location, ':');
/* use a reachable but nonexistent path as the mail root directory */
@@ -306,6 +308,10 @@
ns->flags |= NAMESPACE_FLAG_USABLE;
*_name = mail_namespace_fix_sep(new_ns, name);
*_ns = new_ns;
+ if (_storage->class_flags == 0) {
+ /* flags are unset if we were using "auto" storage */
+ _storage->class_flags = new_ns->storage->class_flags;
+ }
mail_user_add_namespace(user, &new_ns);
return 0;
diff -r 95b08f167d68 -r 18078d6cce84 src/lib-storage/index/shared/shared-storage.h
--- a/src/lib-storage/index/shared/shared-storage.h Wed Nov 16 19:39:18 2011 +0200
+++ b/src/lib-storage/index/shared/shared-storage.h Wed Nov 16 19:39:33 2011 +0200
@@ -10,7 +10,7 @@
const char *ns_prefix_pattern;
const char *location, *unexpanded_location;
- struct mail_storage *storage_class;
+ const char *storage_class_name;
};
struct mailbox_list *shared_mailbox_list_alloc(void);
More information about the dovecot-cvs
mailing list