Commit b94a6d3c b94a6d3cd2112e9b06f069e6ef9789cf6bc0d4e2 by Sergey Poznyakoff

Further fixes in pop3.

* libproto/pop/pop3_create.c (_mu_pop3_init): Fix return value.
* libproto/pop/pop3_destroy.c: Add missing includes.
* libproto/pop/pop3_stream.c (_pop3_decoder): Remove the final
.\r\n altogether.
* mailbox/fltstream.c (filter_read): Remove the hack for supporting
buggy filters.
1 parent d01da801
......@@ -24,6 +24,7 @@
#include <errno.h>
#include <mailutils/errno.h>
#include <mailutils/sys/pop3.h>
#include <mailutils/list.h>
/* Initialise a mu_pop3_t handle. */
......@@ -58,6 +59,7 @@ _mu_pop3_init (mu_pop3_t pop3)
mu_list_destroy (&pop3->capa);
pop3->flags = 0;
}
return 0;
}
......
......@@ -23,6 +23,7 @@
#include <stdlib.h>
#include <mailutils/errno.h>
#include <mailutils/sys/pop3.h>
#include <mailutils/list.h>
void
mu_pop3_destroy (mu_pop3_t *ppop3)
......
......@@ -142,7 +142,8 @@ _pop3_decoder (void *xd,
}
else if (c == '.' && *pstate == pds_crlf)
{
if (i + 1 == isize)
/* Make sure we have two more characters in the buffer */
if (i + 2 == isize)
break;
*pstate = newstate (*pstate, c);
if (*iptr != '\r')
......@@ -154,7 +155,10 @@ _pop3_decoder (void *xd,
}
if (*pstate == pds_end)
{
j -= 2; /* remove the trailing .\n */
iobuf->eof = 1;
}
iobuf->isize = i;
iobuf->osize = j;
return mu_filter_ok;
......
......@@ -159,15 +159,6 @@ filter_read (mu_stream_t stream, char *buf, size_t size, size_t *pret)
switch (res)
{
case mu_filter_ok:
if (iobuf.isize == 0 || iobuf.osize == 0)
{
/* FIXME: Hack to handle eventual buggy filters */
if (iobuf.isize == 0)
min_input_level++;
if (iobuf.osize == 0)
min_output_size++;
continue;
}
if (iobuf.isize > MFB_RDBYTES (fs->inbuf)
|| iobuf.osize > MFB_FREESIZE (fs->outbuf))
return MU_ERR_FAILURE; /* FIXME: special error code? */
......