]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: mail_storage_create() - Add storage_r parameter
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Fri, 29 Dec 2023 15:46:10 +0000 (10:46 -0500)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Wed, 12 Feb 2025 10:34:11 +0000 (12:34 +0200)
src/lib-storage/index/raw/raw-storage.c
src/lib-storage/index/shared/shared-storage.c
src/lib-storage/mail-namespace.c
src/lib-storage/mail-storage.c
src/lib-storage/mail-storage.h

index b6447a86fe7afb01666b2d8179690bdcdd2cc654..e83bc91b2f26d58a3ee0135aea3f85e09e478977 100644 (file)
@@ -22,6 +22,7 @@ raw_storage_create_from_set(struct mail_storage_service_ctx *ctx,
        struct mail_user *user;
        struct mail_namespace *ns;
        struct mail_namespace_settings *ns_set;
+       struct mail_storage *storage;
        struct event *event;
        const char *error;
 
@@ -74,7 +75,7 @@ raw_storage_create_from_set(struct mail_storage_service_ctx *ctx,
        ns->flags |= NAMESPACE_FLAG_NOQUOTA | NAMESPACE_FLAG_NOACL;
        ns->set = ns_set;
 
-       if (mail_storage_create(ns, user->event, 0, &error) < 0)
+       if (mail_storage_create(ns, user->event, 0, &storage, &error) < 0)
                i_fatal("Couldn't create internal raw storage: %s", error);
        if (mail_namespaces_init_finish(ns, &error) < 0)
                i_fatal("Couldn't create internal raw namespace: %s", error);
index ae6876db7e1594c217612fa25fadbf61a0a1d7ed..5efa5726231362b82b6516bff7eed25106e5b1cb 100644 (file)
@@ -421,10 +421,12 @@ shared_mail_user_init(struct mail_storage *_storage,
                return -1;
        }
 
+       struct mail_storage *new_storage;
        new_storage_flags = _storage->flags &
                ENUM_NEGATE(MAIL_STORAGE_FLAG_SHARED_DYNAMIC);
        new_storage_flags |= MAIL_STORAGE_FLAG_NO_AUTOVERIFY;
-       if (mail_storage_create(new_ns, set_event, new_storage_flags, &error) < 0) {
+       if (mail_storage_create(new_ns, set_event, new_storage_flags,
+                               &new_storage, &error) < 0) {
                mailbox_list_set_critical(ns->list, "Namespace %s: %s",
                                          new_ns->prefix, error);
                /* owner gets freed by namespace deinit */
index d1bc9b2599c175c8bea773cce34ab516d760bc61..604ea74886c0754b9a76f951c4ac6c4845b974b3 100644 (file)
@@ -132,6 +132,7 @@ int mail_namespaces_init_add(struct mail_user *user, struct event *set_event,
 {
        enum mail_storage_flags flags = 0;
        struct mail_namespace *ns;
+       struct mail_storage *storage;
        const char *error;
        int ret;
 
@@ -163,7 +164,7 @@ int mail_namespaces_init_add(struct mail_user *user, struct event *set_event,
                ns->flags |= NAMESPACE_FLAG_NOQUOTA | NAMESPACE_FLAG_NOACL;
        }
 
-       if (mail_storage_create(ns, set_event, flags, &error) < 0) {
+       if (mail_storage_create(ns, set_event, flags, &storage, &error) < 0) {
                *error_r = t_strdup_printf("Namespace %s: %s",
                                           ns->set->name, error);
                mail_namespace_free(ns);
@@ -505,6 +506,7 @@ mail_namespaces_init_location_full(struct mail_user *user,
 {
        struct mail_namespace_settings *inbox_set;
        struct mail_namespace *ns;
+       struct mail_storage *storage;
        int ret;
 
        inbox_set = p_new(user->pool, struct mail_namespace_settings, 1);
@@ -536,7 +538,7 @@ mail_namespaces_init_location_full(struct mail_user *user,
                                  SETTINGS_OVERRIDE_TYPE_CODE);
        }
 
-       if (mail_storage_create(ns, set_event, 0, error_r) < 0) {
+       if (mail_storage_create(ns, set_event, 0, &storage, error_r) < 0) {
                mail_namespace_free(ns);
                return -1;
        }
index 81c084c1d70652416560dd5cf4755682d09b89e6..09d0620b03dab761c8d88ab401d492d9a997ac77 100644 (file)
@@ -569,13 +569,13 @@ mail_storage_create_real(struct mail_namespace *ns, struct event *set_event,
 }
 
 int mail_storage_create(struct mail_namespace *ns, struct event *set_event,
-                       enum mail_storage_flags flags, const char **error_r)
+                       enum mail_storage_flags flags,
+                       struct mail_storage **storage_r, const char **error_r)
 {
-       struct mail_storage *storage;
        int ret;
        T_BEGIN {
                ret = mail_storage_create_real(ns, set_event, flags,
-                                              &storage, error_r);
+                                              storage_r, error_r);
        } T_END_PASS_STR_IF(ret < 0, error_r);
        return ret;
 }
index adfabfbadd02b778fbb5e0aba53391767e3738e4..af7e71b33d871c45620a29928cfb28160651ca3f 100644 (file)
@@ -491,7 +491,8 @@ struct mail_storage *mail_storage_find_class(const char *name);
 
 /* Create a storage for the namespace. */
 int mail_storage_create(struct mail_namespace *ns, struct event *event,
-                       enum mail_storage_flags flags, const char **error_r);
+                       enum mail_storage_flags flags,
+                       struct mail_storage **storage_r, const char **error_r);
 void mail_storage_unref(struct mail_storage **storage);
 
 /* Returns the mail storage settings. */