]> dgit.raspbian.org Git - dovecot.git/commitdiff
[PATCH] lib-sieve: sieve-storage - Fix panic caused by flawed detection of personal...
authorStephan Bosch <stephan.bosch@open-xchange.com>
Wed, 4 Mar 2026 20:53:36 +0000 (21:53 +0100)
committerNoah Meyerhans <noahm@debian.org>
Wed, 16 Sep 2026 19:06:35 +0000 (15:06 -0400)
Recent commit d82c2e624e4a9c364a6fa58fad0938ae5578660c added the is_personal
flag, but it is assigned too late. Fix this issue by assigning this flag in the
earliest allocation function.

This issue commonly surfaces when people forget to set an appropriate type for a
script storage definition, in which case the "personal" type is the default.

Panic was:
Panic: file sieve-file-storage-active.c: line 33
(sieve_file_storage_active_read_link): assertion failed: (fstorage->active_path != NULL)

Gbp-Pq: Name 0001-lib-sieve-sieve-storage-Fix-panic-caused-by-flawed-d.patch

pigeonhole/src/lib-sieve/sieve-storage.c

index 455dcffba42de59104547444e615ce03eea0b8ee..ef781a16004560021cd8411f834414d60ecb21b9 100644 (file)
@@ -232,6 +232,9 @@ sieve_storage_alloc_from_class(struct sieve_instance *svinst,
                        storage->pool, "auto:", storage->type, NULL);
        }
 
+       if (strcasecmp(script_type, SIEVE_STORAGE_TYPE_PERSONAL) == 0)
+               storage->is_personal = TRUE;
+
        storage->event = event;
        event_ref(event);
 
@@ -772,8 +775,8 @@ int sieve_storage_create_personal(struct sieve_instance *svinst,
                                        SIEVE_STORAGE_TYPE_PERSONAL, flags,
                                        &storage, error_code_r, NULL);
        if (ret == 0) {
+               i_assert(storage->is_personal);
                (void)sieve_storage_sync_init(storage, user);
-               storage->is_personal = TRUE;
        } else if (*error_code_r != SIEVE_ERROR_TEMP_FAILURE &&
                   (flags & SIEVE_STORAGE_FLAG_SYNCHRONIZING) == 0 &&
                   (flags & SIEVE_STORAGE_FLAG_READWRITE) == 0) {
@@ -1894,7 +1897,7 @@ bool sieve_storage_is_default(const struct sieve_storage *storage)
 
 bool sieve_storage_is_personal(struct sieve_storage *storage)
 {
-       return (strcasecmp(storage->type, SIEVE_STORAGE_TYPE_PERSONAL) == 0);
+       return storage->is_personal;
 }
 
 /*