iterate_query should not include disabled accounts
-
Maybe someone else has an idea on this one (help!)- with this change, I like the results of doveadm user queries better, but when I run an expunge for trash/spam cleanup I get an error, which seems like %s didn't get set:
# /usr/bin/doveadm expunge -A \( mailbox Trash or mailbox SPAM or mailbox Junk or mailbox Deleted or mailbox Deleted\ Items \) savedbefore 30d Error: User listing returned failure doveadm: Error: Failed to iterate through some users
And mail.log shows:
Dec 20 17:10:55 mail-1 dovecot: auth-worker(3178): Error: sql: Iterate query failed: Unknown column 'disable' in 'where clause'
Maybe it's a dovecot bug (running debian stretch, dovecot 2.2.27-3+deb9u1)?
-
-
Running debian jessie (dovecot 2.2.13-12~deb8u3), the patch also leads to the problems described by @jnorell .
doveadm expunge -A mailbox Junk savedbefore 30d
Results in the following error message:
doveadm: Error: User listing returned failure doveadm: Error: Failed to iterate through some users
As a temporary solution, I removed the part ``disable%Ls
=' n'"
because of this.Does anyone have an idea what the iterate_query should read correctly?
-
iterate_query = SELECT email as user FROM mail_user WHERE server_id = '7'
Where server_id is The id of your mailserver.
Works for me Without any problems you need to put this in dovecot-sql.conf
Edited by Pascal Dreissen -
That 'User no longer exists' error is the original issue I started working on. Forcing the query to use the disableimap column would work for imap accounts, but consider a pop3-only installation where they intentionally have set disableimap=y for some or all users - then those pop3 accounts become out of reach for doveadm to act on them.
I'm sure there's a query that would include %s only if set, but I didn't figure it out in some work on it; I've been meaning to get back to this, but have just reverted to the original query on our system till I can do so.
@florian030 if I understand you correctly (ie. try
disable`%Ls`
), I believe I did that as well, with the same results.Edited by Jesse Norell