From e7204bbcf19ff0e4e3d0252e6820bae75b54602c Mon Sep 17 00:00:00 2001
From: Stephan Bosch <stephan.bosch@open-xchange.com>
Date: Tue, 1 Oct 2024 19:59:40 +0200
Subject: [PATCH] lib-sieve: plugins: include: ext-include-common - Allow
 retrieving global scripts from several storages

---
 src/lib-sieve/plugins/include/ext-include-common.c | 10 ++--------
 src/lib-sieve/plugins/include/ext-include-common.h |  1 -
 2 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/src/lib-sieve/plugins/include/ext-include-common.c b/src/lib-sieve/plugins/include/ext-include-common.c
index 59e61825e..bb66aa5e0 100644
--- a/src/lib-sieve/plugins/include/ext-include-common.c
+++ b/src/lib-sieve/plugins/include/ext-include-common.c
@@ -118,7 +118,6 @@ void ext_include_unload(const struct sieve_extension *ext)
 {
 	struct ext_include_context *extctx = ext->context;
 
-	sieve_storage_unref(&extctx->global_storage);
 	sieve_storage_unref(&extctx->personal_storage);
 
 	i_free(extctx->global_location);
@@ -162,14 +161,9 @@ ext_include_open_script_global(struct sieve_instance *svinst,
 			*error_code_r = SIEVE_ERROR_NOT_FOUND;
 		return -1;
 	}
-	if (extctx->global_storage == NULL &&
-	    sieve_storage_create(svinst, svinst->event,
-				 extctx->global_location, 0,
-				 &extctx->global_storage, error_code_r) < 0)
-		return -1;
 
-	return sieve_storage_open_script(extctx->global_storage, script_name,
-					 script_r, error_code_r);
+	return sieve_script_create_open(svinst, extctx->global_location,
+					script_name, script_r, error_code_r);
 }
 
 int ext_include_open_script(const struct sieve_extension *ext,
diff --git a/src/lib-sieve/plugins/include/ext-include-common.h b/src/lib-sieve/plugins/include/ext-include-common.h
index 194e4cb2d..aacd1e097 100644
--- a/src/lib-sieve/plugins/include/ext-include-common.h
+++ b/src/lib-sieve/plugins/include/ext-include-common.h
@@ -101,7 +101,6 @@ struct ext_include_context {
 	/* Configuration */
  	char *global_location;
 
-	struct sieve_storage *global_storage;
 	struct sieve_storage *personal_storage;
 
 	unsigned int max_nesting_depth;
-- 
GitLab