imap login fix

This commit is contained in:
SJ 2014-12-15 22:20:53 +01:00
parent 2348de0b05
commit 12649bee12
2 changed files with 10 additions and 3 deletions

View File

@ -14,7 +14,7 @@
#define VERSION "1.1.1-pre"
#define BUILD 897
#define BUILD 898
#define HOSTID "mailarchiver"

View File

@ -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;