From 9f17a966a4f4c62952694abb0de0b4aed710f073 Mon Sep 17 00:00:00 2001
From: Stephan Bosch <stephan.bosch@open-xchange.com>
Date: Sun, 13 Oct 2024 00:17:04 +0200
Subject: [PATCH] lib-sieve: sieve-storage - Make NULL alloc vfunc an error
 rather than an assert

This allows adding storage class plugin support.
---
 src/lib-sieve/sieve-storage.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/lib-sieve/sieve-storage.c b/src/lib-sieve/sieve-storage.c
index 132640f5d..6c8f1f46f 100644
--- a/src/lib-sieve/sieve-storage.c
+++ b/src/lib-sieve/sieve-storage.c
@@ -302,7 +302,11 @@ sieve_storage_alloc_from_class(struct sieve_instance *svinst,
 
 	i_assert(svinst->username != NULL);
 
-	i_assert(storage_class->v.alloc != NULL);
+	if (storage_class->v.alloc == NULL) {
+		e_error(event, "Support not compiled in for this driver");
+		*error_code_r = SIEVE_ERROR_NOT_FOUND;
+		return -1;
+	}
 
 	if ((flags & SIEVE_STORAGE_FLAG_SYNCHRONIZING) != 0 &&
 	    !storage_class->allows_synchronization) {
-- 
GitLab