diff --git a/src/config.h b/src/config.h index 7064e944..f2ef3f9c 100644 --- a/src/config.h +++ b/src/config.h @@ -14,7 +14,7 @@ #define VERSION "1.1.1-pre" -#define BUILD 897 +#define BUILD 898 #define HOSTID "mailarchiver" diff --git a/src/imap.c b/src/imap.c index 21f3c028..d5245c2b 100644 --- a/src/imap.c +++ b/src/imap.c @@ -56,10 +56,11 @@ int get_message_length_from_imap_answer(char *s){ int read_response(int sd, char *buf, int buflen, int *seq, struct __data *data, int use_ssl){ int i=0, n, len=0, rc=0; - char puf[MAXBUFSIZE], tagok[SMALLBUFSIZE], tagno[SMALLBUFSIZE]; + char puf[MAXBUFSIZE], tagok[SMALLBUFSIZE], tagno[SMALLBUFSIZE], tagbad[SMALLBUFSIZE]; snprintf(tagok, sizeof(tagok)-1, "A%d OK", *seq); snprintf(tagno, sizeof(tagno)-1, "A%d NO", *seq); + snprintf(tagbad, sizeof(tagbad)-1, "A%d BAD", *seq); memset(buf, 0, buflen); @@ -69,7 +70,13 @@ int read_response(int sd, char *buf, int buflen, int *seq, struct __data *data, if(n + len < buflen) strncat(buf, puf, n); else goto END; - if(i == 0 && strstr(puf, tagno)) goto END; + /* + * possible error message from the imap server: + * + * * BYE Temporary problem, please try again later\r\n + */ + + if(i == 0 && (strstr(puf, tagno) || strstr(puf, tagbad) || strstr(puf, "* BYE ")) ) goto END; len += n;