]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: shared driver - Remove copying the child storage's class_flags
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 19 Feb 2018 11:22:02 +0000 (13:22 +0200)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 20 Feb 2018 13:50:37 +0000 (15:50 +0200)
The shared storage root itself doesn't have any storage, so it shouldn't
need to copy the child storage's class_flags either.

This fixes a crash when shared namespace was created with mdbox storage, and
another mdbox namespace was created afterwards. This had
MAIL_STORAGE_CLASS_FLAG_UNIQUE_ROOT set, but its unique_root_dir is NULL,
which caused a crash in mail_storage_match_class().

src/lib-storage/index/shared/shared-storage.c

index 51ab16de417aead436bf0adcebbba0fca0bcc03d..b5092528aa969bfb5342163836976cfa09d0654f 100644 (file)
@@ -32,7 +32,6 @@ shared_storage_create(struct mail_storage *_storage, struct mail_namespace *ns,
                      const char **error_r)
 {
        struct shared_storage *storage = SHARED_STORAGE(_storage);
-       struct mail_storage *storage_class;
        const char *driver, *p;
        char *wildcardp, key;
        bool have_username;
@@ -49,10 +48,8 @@ shared_storage_create(struct mail_storage *_storage, struct mail_namespace *ns,
                p_strdup(_storage->pool, ns->unexpanded_set->location);
        storage->storage_class_name = p_strdup(_storage->pool, driver);
 
-       storage_class = mail_user_get_storage_class(_storage->user, driver);
-       if (storage_class != NULL)
-               _storage->class_flags = storage_class->class_flags;
-       else if (strcmp(driver, "auto") != 0) {
+       if (mail_user_get_storage_class(_storage->user, driver) == NULL &&
+           strcmp(driver, "auto") != 0) {
                *error_r = t_strconcat("Unknown shared storage driver: ",
                                       driver, NULL);
                return -1;