File 0002-Ignore-broken-and-missing-sieve-scripts-during-repli.patch of Package cyrus-imapd-3
From e88b325855b83ff366c8108114ced33ec8f964b2 Mon Sep 17 00:00:00 2001
From: Christian Mollekopf <mollekopf@apheleia-it.ch>
Date: Wed, 15 Mar 2023 15:58:09 +0100
Subject: [PATCH 2/2] Ignore broken and missing sieve scripts during
replication
Required to synchronize legacy sieve scripts
---
imap/sync_support.c | 14 +++++++++++++-
lib/imapoptions | 5 +++++
2 files changed, 18 insertions(+), 1 deletion(-)
mode change 100644 => 100755 imap/sync_support.c
diff --git a/imap/sync_support.c b/imap/sync_support.c
old mode 100644
new mode 100755
index e6e558d6f..f2699108a
--- a/imap/sync_support.c
+++ b/imap/sync_support.c
@@ -933,7 +933,13 @@ int sync_sieve_activate(const char *userid, const char *bcname)
(int) strlen(bcname) - BYTECODE_SUFFIX_LEN, bcname);
r = sievedb_lookup_name(db, name, &sdata, 0);
- if (r) goto done;
+ if (r) {
+ if (config_getswitch(IMAPOPT_SYNC_IGNORE_SIEVE_ERRORS)) {
+ syslog(LOG_ERR, "Failed to find the sieve script to activate: %s. Ignoring", bcname);
+ r = 0;
+ }
+ goto done;
+ }
}
r = sieve_script_activate(mailbox, sdata);
@@ -3447,6 +3453,12 @@ int sync_sieve_upload(const char *userid, const char *fname,
}
r = sieve_script_store(mailbox, sdata, &buf);
+ if (r) {
+ if (config_getswitch(IMAPOPT_SYNC_IGNORE_SIEVE_ERRORS)) {
+ syslog(LOG_ERR, "Failed to store the sieve script %s for %s. Ignoring", name, userid);
+ r = 0;
+ }
+ }
done:
if (!r) sync_log_sieve(userid);
diff --git a/lib/imapoptions b/lib/imapoptions
index c15163265..384fb523b 100644
--- a/lib/imapoptions
+++ b/lib/imapoptions
@@ -2827,6 +2827,11 @@ product version in the capabilities
sync_client will only use csync. Prefix with a channel name to
apply only for that channel */
+{ "sync_ignore_sieve_errors", 0, SWITCH, "3.6.0" }
+/* Whether sync_client should ignore errors related to sieve
+ script creation, and activation. Useful to fix replication
+ with legacy backends*/
+
{ "syslog_prefix", NULL, STRING, "3.1.8" }
/* String to be prepended to the process name in syslog entries. Can
be further overridden by setting the $CYRUS_SYSLOG_PREFIX environment
--
2.39.2