From: Timo Sirainen Date: Mon, 19 Feb 2018 11:22:02 +0000 (+0200) Subject: lib-storage: shared driver - Remove copying the child storage's class_flags X-Git-Tag: 2.3.9~2243 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0116003edce8cad684715b1b37cf57e3674cf2cb;p=thirdparty%2Fdovecot%2Fcore.git lib-storage: shared driver - Remove copying the child storage's class_flags 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(). --- diff --git a/src/lib-storage/index/shared/shared-storage.c b/src/lib-storage/index/shared/shared-storage.c index 51ab16de41..b5092528aa 100644 --- a/src/lib-storage/index/shared/shared-storage.c +++ b/src/lib-storage/index/shared/shared-storage.c @@ -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;