Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sun, 26 Jan 2003 07:45:52 +0300
From: Solar Designer <solar@...nwall.com>
To: popa3d-users@...ts.openwall.com
Subject: Re: "was not the expected length ..." errors

On Sat, Jan 25, 2003 at 08:42:39PM +0000, Nuno Teixeira wrote:

Hi,

>     I'm making tests with fetchmail on FreeBSD 5.0R and it gives the error: 
>     "... was not the expected length (608 actual != 610 expected)" but it 
>     fetches the mail ok.

Thanks a lot for your report.

Actually, this appears to be a bug I've introduced in popa3d 0.4.9.3.
Before this version, popa3d would often include the mailbox separator
trailing empty line in messages.  I decided that I don't like this
(the line is a part of the mailbox format, not a part of the messages)
and killed this property in 0.4.9.3.  Unfortunately, this lack of an
empty line triggered a bug in Outlook Express (now worked around in
0.5.9 by still adding the empty line whenever necessary for MSOE), and
as you have now noticed I forgot to update the reported message length
accordingly.  I wish someone who uses fetchmail reported this earlier.
Other POP3 clients clearly don't do this check because it doesn't
really affect anything (there's a more reliable way to see when a
whole message has been received).

Please test the patch below (against 0.5.9) and let me know if it
solves the problem for you.  I will then include it in the release.

diff -ur popa3d-0.5.9/mailbox.c popa3d-0.5.9-size-fix/mailbox.c
--- popa3d-0.5.9/mailbox.c	Sun Sep  8 13:52:57 2002
+++ popa3d-0.5.9-size-fix/mailbox.c	Sun Jan 26 07:30:26 2003
@@ -227,6 +227,7 @@
 				if (!msg.data_offset) break;
 				msg.raw_size = offset - msg.raw_offset;
 				msg.data_size = offset - body - msg.data_offset;
+				msg.size -= body << 1;
 				MD5_Final(msg.hash, &hash);
 				if (db_op(&msg)) break;
 			}
@@ -319,6 +320,7 @@
 		if (!msg.data_offset) return 1;
 		msg.raw_size = offset - msg.raw_offset;
 		msg.data_size = offset - (blank & body) - msg.data_offset;
+		msg.size -= (blank & body) << 1;
 		MD5_Final(msg.hash, &hash);
 		if (db_op(&msg)) return 1;
 
-- 
/sd

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.