[Dovecot] Dovecot Antispam plugin

Timo Sirainen tss at iki.fi
Mon Jun 15 22:08:41 EEST 2009


On Mon, 2009-06-15 at 21:03 +0200, Johannes Berg wrote:
> Christian has reported an error to me on dovecot 1.0.7, where the
> following code:
> 
>  199         if (i_stream_read_data(mailstream, &beginning, &size, 5) < 0 ||
>  200             size < 5) {
..
>  212                 if (o_stream_send(outstream, beginning, 5) != 5) {
..
>  221         if (o_stream_send_istream(outstream, mailstream) < 0) {
..
> with a mailstream that start with "X-Spam-..." will result in a file
> stored that starts with "X-SpaX-Spam-...". I've read the above code many
> times now and tried to find a problem with it, but I don't see it --
> could you help us?

The problem is that the istream API doesn't work the way you expect.
Just reading doesn't advance the stream, only calling i_stream_skip() or
i_stream_seek() does that (and o_stream_send_istream() internally). So
just remove the o_stream_send(beginning) call and it'll work.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : http://dovecot.org/pipermail/dovecot/attachments/20090615/b18e3eed/attachment.bin 


More information about the dovecot mailing list