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.
Showing
4 changed files
with
8 additions
and
10 deletions
... | @@ -24,6 +24,7 @@ | ... | @@ -24,6 +24,7 @@ |
24 | #include <errno.h> | 24 | #include <errno.h> |
25 | #include <mailutils/errno.h> | 25 | #include <mailutils/errno.h> |
26 | #include <mailutils/sys/pop3.h> | 26 | #include <mailutils/sys/pop3.h> |
27 | #include <mailutils/list.h> | ||
27 | 28 | ||
28 | /* Initialise a mu_pop3_t handle. */ | 29 | /* Initialise a mu_pop3_t handle. */ |
29 | 30 | ||
... | @@ -58,6 +59,7 @@ _mu_pop3_init (mu_pop3_t pop3) | ... | @@ -58,6 +59,7 @@ _mu_pop3_init (mu_pop3_t pop3) |
58 | mu_list_destroy (&pop3->capa); | 59 | mu_list_destroy (&pop3->capa); |
59 | pop3->flags = 0; | 60 | pop3->flags = 0; |
60 | } | 61 | } |
62 | return 0; | ||
61 | } | 63 | } |
62 | 64 | ||
63 | 65 | ... | ... |
... | @@ -23,6 +23,7 @@ | ... | @@ -23,6 +23,7 @@ |
23 | #include <stdlib.h> | 23 | #include <stdlib.h> |
24 | #include <mailutils/errno.h> | 24 | #include <mailutils/errno.h> |
25 | #include <mailutils/sys/pop3.h> | 25 | #include <mailutils/sys/pop3.h> |
26 | #include <mailutils/list.h> | ||
26 | 27 | ||
27 | void | 28 | void |
28 | mu_pop3_destroy (mu_pop3_t *ppop3) | 29 | mu_pop3_destroy (mu_pop3_t *ppop3) | ... | ... |
... | @@ -142,7 +142,8 @@ _pop3_decoder (void *xd, | ... | @@ -142,7 +142,8 @@ _pop3_decoder (void *xd, |
142 | } | 142 | } |
143 | else if (c == '.' && *pstate == pds_crlf) | 143 | else if (c == '.' && *pstate == pds_crlf) |
144 | { | 144 | { |
145 | if (i + 1 == isize) | 145 | /* Make sure we have two more characters in the buffer */ |
146 | if (i + 2 == isize) | ||
146 | break; | 147 | break; |
147 | *pstate = newstate (*pstate, c); | 148 | *pstate = newstate (*pstate, c); |
148 | if (*iptr != '\r') | 149 | if (*iptr != '\r') |
... | @@ -154,7 +155,10 @@ _pop3_decoder (void *xd, | ... | @@ -154,7 +155,10 @@ _pop3_decoder (void *xd, |
154 | } | 155 | } |
155 | 156 | ||
156 | if (*pstate == pds_end) | 157 | if (*pstate == pds_end) |
158 | { | ||
159 | j -= 2; /* remove the trailing .\n */ | ||
157 | iobuf->eof = 1; | 160 | iobuf->eof = 1; |
161 | } | ||
158 | iobuf->isize = i; | 162 | iobuf->isize = i; |
159 | iobuf->osize = j; | 163 | iobuf->osize = j; |
160 | return mu_filter_ok; | 164 | return mu_filter_ok; | ... | ... |
... | @@ -159,15 +159,6 @@ filter_read (mu_stream_t stream, char *buf, size_t size, size_t *pret) | ... | @@ -159,15 +159,6 @@ filter_read (mu_stream_t stream, char *buf, size_t size, size_t *pret) |
159 | switch (res) | 159 | switch (res) |
160 | { | 160 | { |
161 | case mu_filter_ok: | 161 | case mu_filter_ok: |
162 | if (iobuf.isize == 0 || iobuf.osize == 0) | ||
163 | { | ||
164 | /* FIXME: Hack to handle eventual buggy filters */ | ||
165 | if (iobuf.isize == 0) | ||
166 | min_input_level++; | ||
167 | if (iobuf.osize == 0) | ||
168 | min_output_size++; | ||
169 | continue; | ||
170 | } | ||
171 | if (iobuf.isize > MFB_RDBYTES (fs->inbuf) | 162 | if (iobuf.isize > MFB_RDBYTES (fs->inbuf) |
172 | || iobuf.osize > MFB_FREESIZE (fs->outbuf)) | 163 | || iobuf.osize > MFB_FREESIZE (fs->outbuf)) |
173 | return MU_ERR_FAILURE; /* FIXME: special error code? */ | 164 | return MU_ERR_FAILURE; /* FIXME: special error code? */ | ... | ... |
-
Please register or sign in to post a comment