]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: shared - Fix handling errors initializing shared mailbox owner user
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Fri, 27 Jan 2023 19:59:00 +0000 (21:59 +0200)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Sat, 28 Jan 2023 18:21:08 +0000 (18:21 +0000)
Broken by 46289fd0efce678c07f13bfa5f3cb077d2ea8cb8

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

index c0cc33e83ea41589d2314b1f58a596328c2ddfcd..1eae49cb140de930eeef69f628d37c847beee3d7 100644 (file)
@@ -275,14 +275,16 @@ int shared_storage_get_namespace(struct mail_namespace **_ns,
        };
        if (mail_storage_service_lookup_next(storage_service, &input,
                                             &owner, &error) < 0) {
-               if (owner != NULL && !owner->nonexistent) {
+               if (owner == NULL || !owner->nonexistent) {
                        mailbox_list_set_critical(list,
                                "Couldn't create namespace '%s' for user %s: %s",
-                               ns->prefix, owner->username, error);
-                       mail_user_deinit(&owner);
+                               ns->prefix, userdomain, error);
+                       if (owner != NULL)
+                               mail_user_deinit(&owner);
                        io_loop_context_switch(old_ioloop_ctx);
                        return -1;
                }
+               /* owner is a nonexistent user */
        }
 
        owner->creator = user;