From: Stephan Bosch Date: Tue, 25 Nov 2025 04:07:16 +0000 (+0100) Subject: [PATCH] lib-sieve: sieve-storage - Add is_personal bit X-Git-Tag: archive/raspbian/1%2.4.1+dfsg1-6+rpi1+deb13u7^2~116 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=c8a8236eebeea4c935490fd40ee1071d01093dcc;p=dovecot.git [PATCH] lib-sieve: sieve-storage - Add is_personal bit Simpler than evaluating the type and personal storage is created only through sieve_storage_create_personal(). This mimics the bit for default storage. Gbp-Pq: Name 0001-lib-sieve-sieve-storage-Add-is_personal-bit.patch --- diff --git a/pigeonhole/src/lib-sieve/sieve-storage-private.h b/pigeonhole/src/lib-sieve/sieve-storage-private.h index 32ad37d..1bccdca 100644 --- a/pigeonhole/src/lib-sieve/sieve-storage-private.h +++ b/pigeonhole/src/lib-sieve/sieve-storage-private.h @@ -121,6 +121,7 @@ struct sieve_storage { enum sieve_storage_flags flags; bool allows_synchronization:1; + bool is_personal:1; bool is_default:1; }; diff --git a/pigeonhole/src/lib-sieve/sieve-storage.c b/pigeonhole/src/lib-sieve/sieve-storage.c index e68fe39..455dcff 100644 --- a/pigeonhole/src/lib-sieve/sieve-storage.c +++ b/pigeonhole/src/lib-sieve/sieve-storage.c @@ -773,6 +773,7 @@ int sieve_storage_create_personal(struct sieve_instance *svinst, &storage, error_code_r, NULL); if (ret == 0) { (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) { @@ -1017,7 +1018,7 @@ sieve_storage_get_default_script(struct sieve_storage *storage, if (*error_code_r != SIEVE_ERROR_NOT_FOUND || (storage->flags & SIEVE_STORAGE_FLAG_SYNCHRONIZING) != 0 || - !sieve_storage_is_personal(storage)) + !storage->is_personal) return -1; /* Not found; if this name maps to the default script, diff --git a/pigeonhole/src/lib-sieve/storage/file/sieve-file-storage.c b/pigeonhole/src/lib-sieve/storage/file/sieve-file-storage.c index 8f89145..75d62cb 100644 --- a/pigeonhole/src/lib-sieve/storage/file/sieve-file-storage.c +++ b/pigeonhole/src/lib-sieve/storage/file/sieve-file-storage.c @@ -459,11 +459,9 @@ sieve_file_storage_init_from_settings( /* Stat storage directory */ - bool is_personal = sieve_storage_is_personal(storage); - if (storage_path != NULL && *storage_path != '\0') { if (sieve_file_storage_stat(fstorage, storage_path) < 0) { - if (!is_personal || + if (!storage->is_personal || storage->error_code != SIEVE_ERROR_NOT_FOUND) return -1; if ((storage->flags & SIEVE_STORAGE_FLAG_READWRITE) == 0) { @@ -511,7 +509,7 @@ sieve_file_storage_init_from_settings( } if ((active_path == NULL || *active_path == '\0') && - (is_personal || + (storage->is_personal || (storage->flags & SIEVE_STORAGE_FLAG_READWRITE) != 0)) { e_debug(storage->event, "Active script path is unconfigured; "