imapc tries to fetch uid 0

Nagy, Attila bra at fsn.hu
Wed Mar 30 13:08:11 UTC 2016


On 03/29/16 19:41, Timo Sirainen wrote:
>> On 19 Feb 2016, at 17:12, Nagy, Attila <bra at fsn.hu> wrote:
>>
>> Hi,
>>
>> This is a capture from an imapc client session (which is triggered by a message, received via LMTP):
>> * OK [CAPABILITY IMAP4rev1 NAMESPACE] Ready
>> 2 LOGIN "uid" "pass"
>> 2 OK LOGIN succeeded
>> 1 LIST "" ""
>> * LIST (\Noselect) "/" ""
>> 1 OK LIST completed
>> 3 APPEND "INBOX" {568}
>> + Ready for 568 octets of data
>> [...]
>> 3 OK APPEND complete
>> 4 EXAMINE "INBOX"
>> * FLAGS (\Answered \Flagged \Deleted \Seen \Draft)
>> * OK [PERMANENTFLAGS (\Answered \Flagged \Deleted \Seen \Draft \*)] Flags permitted.
>> * 4 EXISTS
>> * 0 RECENT
>> * OK [UIDVALIDITY 1455885804]
>> * OK [UIDNEXT 5]
>> 4 OK [READ-ONLY] EXAMINE successful
>> 5 UID FETCH 0 (RFC822.SIZE BODY.PEEK[HEADER.FIELDS (Message-ID)])
>> 5 BAD Illegal syntax: Bad message number 0
>>
>> Dovecot 2.2.21
>>
>> I don't see any problems with the conversation otherwise. Is it safe to assume this is a bug in imapc?
> doveconf -n would be helpful. I guess you have mail_log plugin enabled? And imapc isn't used with any index directory? So Dovecot attempts to log Message-ID and size after saving a mail, but those aren't in cache (because indexes are disabled) and the transaction isn't committed yet either so the mail has no UID.
>
> So the only fix for now that I can do is to just not send the FETCH command and instead fail it immediately:
> https://github.com/dovecot/core/commit/969f57f722570982a5febbaab2462b692aa68733
>
> Any further fixing would become difficult.
>
I don't have mail_log enabled (currently, but will be) and indexes 
aren't disabled.

Here's the actual config:
# 2.2.22 (fe789d2): /usr/local/etc/dovecot/dovecot.conf
# Pigeonhole version 0.4.13 (7b14904)
# OS: FreeBSD 10.3-PRERELEASE amd64
auth_mechanisms = plain login
disable_plaintext_auth = no
imapc_features = rfc822.size fetch-headers
imapc_host = 127.0.0.1
imapc_port = 1430
lmtp_proxy = yes
mail_gid = imapproxy
mail_home = /usr/home/imapproxy/%2.256Nu/%u
mail_location = imapc:~/imapc
mail_prefetch_count = 100
mail_uid = imapproxy
managesieve_notify_capability = mailto
managesieve_sieve_capability = fileinto reject envelope 
encoded-character vacation subaddress comparator-i;ascii-numeric 
relational regex imap4flags copy include variables body enotify 
environment mailbox date index ihave duplicate mime foreverypart extracttext
namespace inbox {
   inbox = yes
   location =
   mailbox Drafts {
     special_use = \Drafts
   }
   mailbox Junk {
     special_use = \Junk
   }
   mailbox Sent {
     special_use = \Sent
   }
   mailbox "Sent Messages" {
     special_use = \Sent
   }
   mailbox Trash {
     special_use = \Trash
   }
   prefix =
}
passdb {
   args = /usr/local/etc/dovecot/dovecot-dict-auth.conf.ext
   driver = dict
}
postmaster_address = postmaster
service lmtp {
   inet_listener lmtp {
     address = 127.0.0.1
     port = 24
   }
   unix_listener /var/spool/postfix/private/dovecot-lmtp {
     group = postfix
     mode = 0600
     user = postfix
   }
}
ssl = no
userdb {
   driver = prefetch
}
userdb {
   args = /usr/local/etc/dovecot/dovecot-dict-auth.conf.ext
   driver = dict
}
protocol lmtp {
   mail_plugins = " sieve"
}

The user home contains a dovecot.index.cache and a .log file.
During the LMTP delivery (which turns into an IMAP APPEND, maybe this is 
where the bug lies? It's not too typical to do this I guess), they 
aren't changed.



More information about the dovecot mailing list