Op 10-9-2025 om 00:58 schreef Stephan Bosch via dovecot:
Op 9-9-2025 om 02:51 schreef Stephan Bosch via dovecot:
This looks a lot like a bug. Will investigate..
I can reproduce it. Now to find the cause...
This fixes it here:
diff --git a/src/lib-sieve/sieve-script.c b/src/lib-sieve/sieve-script.c
index 67526c4ef..bdbee1ac9 100644
--- a/src/lib-sieve/sieve-script.c
+++ b/src/lib-sieve/sieve-script.c
@@ -1232,7 +1232,7 @@ int sieve_script_sequence_next(struct
sieve_script_sequence *sseq,
i_assert(storage->error_code != SIEVE_ERROR_NONE);
i_assert(storage->error != NULL);
- if (*error_code_r == SIEVE_ERROR_NOT_FOUND)
+ if (storage->error_code == SIEVE_ERROR_NOT_FOUND)
ret = 0;
else {
*error_code_r = storage->error_code;
Putting this through the release cycle may take while...
Op 15-8-2025 om 12:29 schreef Niklas Meyer via dovecot:
Hello everyone,
I am currently working on porting the Dovecot 2.4 configuration
from the
latest 2.3 version.
During this process, I encountered issues with the Sieve filters,
particularly those related to SQL dict mappings.
The previous (2.3) configuration looked like this and worked:
map {
pattern = priv/sieve/name/$script_name
table = sieve_before
username_field = username
value_field = id
fields {
script_name = $script_name
}
}
map {
pattern = priv/sieve/data/$id
table = sieve_before
username_field = username
value_field = script_data
fields {
id = $id
}
}
This resulted in the following SQL queries on the MySQL server:
2025-08-15 11:01:29.237511 SELECT id FROM sieve_after WHERE
script_name = 'active' AND username = '[1]frittenjo...@derlinkman.de'
2025-08-15 11:01:29.236416 SELECT id FROM sieve_before WHERE
script_name = 'active' AND username = '[2]frittenjo...@derlinkman.de'
As you can see, there are SQL mappings for sieve_before and
sieve_after,
alongside a local file loaded prior to the SQL settings, as they
are
user-based.
In Dovecot 2.3, everything worked and the scripts were executed.
In 2.4,
however, they no longer run.
I adapted the configuration for dict SQL mapping for Sieve filters
according to the documentation:
dict_map priv/sieve/name/$script_name {
sql_table = sieve_before
username_field = username
value_field id {
}
# The script name field in the table to query
key_field script_name {
value = $script_name
}
}
dict_map priv/sieve/data/$id {
sql_table = sieve_before
username_field = username
value_field script_data {
}
key_field id {
value = $id
}
}
This also results in the dict proxy querying the database with
the same
pattern as before:
2025-08-15 11:11:47.175184 SELECT id FROM sieve_after WHERE
script_name = 'active' AND username = '[3]frittenjo...@derlinkman.de'
2025-08-15 11:11:47.172952 SELECT id FROM sieve_before WHERE
script_name = 'active' AND username = '[4]frittenjo...@derlinkman.de'
2025-08-15 11:11:47.155786 SELECT id FROM sieve_after WHERE
script_name = 'active' AND username = '[5]frittenjo...@derlinkman.de'
2025-08-15 11:11:47.136030 SELECT id FROM sieve_before WHERE
script_name = 'active' AND username = '[6]frittenjo...@derlinkman.de'
However, unlike in 2.3, it now queries the DB twice.
In the Sieve debug logs, I see the following:
[7]https://pastebin.com/PTKkLsDQ
Notably:
Aug 15 12:22:24 43664c142e0a dovecot:
lmtp([8]frittenjo...@derlinkman.de)<2407><mPFNN2AKn2hnCQAAhwrv7A>:
Debug: Local delivery failed: Temporarily unable to access necessary
Sieve scripts
This line concerns me.
Here are the current Sieve script declarations:
sieve_script before {
type = before
driver = file
path = /var/vmail/sieve/global_sieve_before.sieve
}
sieve_script before2 {
type = before
driver = dict
name = active
dict proxy {
name = sieve_before
sieve_script_bin_path = /var/vmail/sieve_before_bindir
}
}
sieve_script after {
type = after
driver = file
path = /var/vmail/sieve/global_sieve_after.sieve
}
sieve_script after2 {
type = after
driver = dict
name = active
dict proxy {
name = sieve_after
sieve_script_bin_path = /var/vmail/sieve_after_bindir
}
}
# Personal scripts
sieve_script personal {
type = personal
driver = file
path = ~/sieve
active_path = ~/.dovecot.sieve
}
The dict proxy configuration, pointing to the dict_map SQL query
above,
looks like this:
dict sieve_after {
driver = sql
!include /etc/dovecot/sql/dovecot-dict-sql-sieve_after.conf
}
dict sieve_before {
driver = sql
!include /etc/dovecot/sql/dovecot-dict-sql-sieve_before.conf
}
Thanks for your guidance.
Kind regards
Niklas Meyer
Maintainer of the mailcow project
References
Visible links
1. mailto:frittenjo...@derlinkman.de
2. mailto:frittenjo...@derlinkman.de
3. mailto:frittenjo...@derlinkman.de
4. mailto:frittenjo...@derlinkman.de
5. mailto:frittenjo...@derlinkman.de
6. mailto:frittenjo...@derlinkman.de
7. https://pastebin.com/PTKkLsDQ
8. mailto:frittenjo...@derlinkman.de
_______________________________________________
dovecot mailing list -- dovecot@dovecot.org
To unsubscribe send an email to dovecot-le...@dovecot.org
_______________________________________________
dovecot mailing list -- dovecot@dovecot.org
To unsubscribe send an email to dovecot-le...@dovecot.org
_______________________________________________
dovecot mailing list -- dovecot@dovecot.org
To unsubscribe send an email to dovecot-le...@dovecot.org
_______________________________________________
dovecot mailing list -- dovecot@dovecot.org
To unsubscribe send an email to dovecot-le...@dovecot.org