Skip to content

Commit

Permalink
lib-storage: shared driver - Remove copying the child storage's class…
Browse files Browse the repository at this point in the history
…_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().
  • Loading branch information
sirainen committed Feb 20, 2018
1 parent 5d60e31 commit 0116003
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/lib-storage/index/shared/shared-storage.c
Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 0116003

Please sign in to comment.