aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--driver.c13
-rw-r--r--imap.c17
2 files changed, 16 insertions, 14 deletions
diff --git a/driver.c b/driver.c
index afe303c2..7349efdf 100644
--- a/driver.c
+++ b/driver.c
@@ -1028,17 +1028,24 @@ char *realname; /* real name of host */
SockWrite(ctl->smtp_socket, "\r\n", 2);
}
-
/*
* If we're using IMAP4 or something else that can fetch headers
* separately from bodies, it's time to grab the body now. This
* fetch may be skipped if we got an anti-spam or other error
* response from SMTP above.
+ *
+ * The protocol methods should never fail here. Just in case...
+ * we return PS_TRANSIENT because failure could not be due
+ * to desynchronization or permanent request failure.
*/
if (protocol->fetch_body)
{
- (protocol->trail)(sock, ctl, -1);
- (protocol->fetch_body)(sock, ctl, num, &remaining);
+ int ok;
+
+ if ((ok = (protocol->trail)(sock, ctl, num)))
+ return(PS_TRANSIENT);
+ if ((ok = (protocol->fetch_body)(sock, ctl, num, &remaining)))
+ return(PS_TRANSIENT);
}
/*
diff --git a/imap.c b/imap.c
index 8e675b61..b887f94a 100644
--- a/imap.c
+++ b/imap.c
@@ -194,16 +194,11 @@ static int imap_fetch_headers(int sock, struct query *ctl, int number, int *lenp
/* expunges change the fetch numbers */
number -= deletecount;
- switch (imap_version)
- {
- case IMAP4rev1: /* RFC 2060 */
- gen_send(sock, "FETCH %d BODY[HEADER]", number);
- break;
-
- default: /* RFC 1176 */
- gen_send(sock, "FETCH %d RFC822.HEADER", number);
- break;
- }
+ /*
+ * This is blessed by RFC 1176, RFC1730, RFC2060.
+ * it should *not* set the \Seen flag.
+ */
+ gen_send(sock, "FETCH %d RFC822.HEADER", number);
/* looking for FETCH response */
do {
@@ -221,7 +216,7 @@ static int imap_fetch_headers(int sock, struct query *ctl, int number, int *lenp
}
static int imap_fetch_body(int sock, struct query *ctl, int number, int *lenp)
-/* request nth message */
+/* request headers of nth message */
{
char buf [POPBUFSIZE+1];
int num;