Mark Weaver
2013-Sep-24  23:06 UTC
[Dovecot] imaptest-20130617 seems to be reporting spurious header changes
I'm trying to use this to test an IMAP server I'm developing (I picked 
the nightly up from the link on the wiki page at 
http://www.imapwiki.org/ImapTest/Installation).  With one client using 
the mailbox dovecot-crlf (http://www.dovecot.org/tmp/dovecot-crlf) I get 
messages like:
Error: test at npsl.co.uk[67]: 1035253882.5041.34.camel at hurina: Header From 
changed 'Timo Sirainen <tss at iki.fi>
Timo Sirainen <tss at iki.fi' (len 52) -> 'Timo Sirainen <tss
at iki.fi>' (len
26): * 1 FETCH (UID 2093 FLAGS () BODY ("text" "plain"
("charset"
"us-ascii") NIL NIL "7bit" 913 0) BODY[HEADER.FIELDS (From
From
Delivered-To) ] "From: Timo Sirainen <tss at iki.fi>
From: Timo Sirainen <tss at iki.fi>
Delivered-To: dovecot at procontrol.fi
" ENVELOPE ("22 Oct 2002 05:31:22 +0300" "[dovecot] Re:
Architectural
questions" (("Timo Sirainen" NIL "tss"
"iki.fi")) (("" NIL
"dovecot-bounce" "procontrol.fi")) (("Timo
Sirainen" NIL "tss"
"iki.fi")) (("" NIL "dovecot"
"procontrol.fi")) NIL NIL
"<1035249894.5044.28.camel at hurina>"
"<1035253882.5041.34.camel at hurina>")
BODY[HEADER.FIELDS (Cc Cc From) ] "From: Timo Sirainen <tss at
iki.fi>
")
(I added the dump of the string length by modifying the code).  As I am 
reading it the test program has got the wrong string rather than the 
server -- the From header in the mbox file is
From: Timo Sirainen <tss at iki.fi>
which is 26 characters long, not 52, and includes the closing angle 
bracket, and the code that prints the header out is in 
src/mailbox-state.c, line 377:
                         client_state_error(client,
                                 "%s: Header %s changed '%.*s' (len
%d)
-> '%.*\
s' (len %d)",
                                 msg->message_id, fetch_headers[i].name,
                                 (int)orig_headers[j].value_len,
                                 (const char *)orig_headers[j].value,
                                 (int)orig_headers[j].value_len,
                                 (int)fetch_headers[i].value_len,
                                 (const char *)fetch_headers[i].value,
                                 (int)fetch_headers[i].value_len);
Have I read this upside down or is there an issue with the tests?  If it 
is an issue with the tests, any pointers as to where to start looking 
for the issue would be helpful.
Thanks,
Mark
Timo Sirainen
2013-Sep-25  00:58 UTC
[Dovecot] imaptest-20130617 seems to be reporting spurious header changes
On 25.9.2013, at 2.06, Mark Weaver <mark-clist at npsl.co.uk> wrote:> I'm trying to use this to test an IMAP server I'm developing (I picked the nightly up from the link on the wiki page at http://www.imapwiki.org/ImapTest/Installation). With one client using the mailbox dovecot-crlf (http://www.dovecot.org/tmp/dovecot-crlf) I get messages like: > > Error: test at npsl.co.uk[67]: 1035253882.5041.34.camel at hurina: Header From changed 'Timo Sirainen <tss at iki.fi> > Timo Sirainen <tss at iki.fi' (len 52) -> 'Timo Sirainen <tss at iki.fi>' (len 26): * 1 FETCH (UID 2093 FLAGS () BODY ("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 913 0) BODY[HEADER.FIELDS (From From Delivered-To) ] "From: Timo Sirainen <tss at iki.fi> > From: Timo Sirainen <tss at iki.fi> > Delivered-To: dovecot at procontrol.fiHmm. Interesting question. The issue here is that imaptest requests the From field twice, and you return it twice. Normally clients wouldn't do that, but I think the imaptest is correct here and I think most existing server implementations handle it like imaptest expects. From RFC 3501: HEADER.FIELDS and HEADER.FIELDS.NOT are followed by a list of field-name (as defined in [RFC-2822]) names, and return a subset of the header. Duplicating a From field is no longer a subset of the original header.