X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fmodules%2Fpop3client%2Fserv_pop3client.c;h=81feca096c9410fc52ac54865480b007e765a2cd;hb=c90526de5f779ce083f75c7a557dee158bd927d7;hp=4fe026efab3bcf691205fedf815e91c90ba48bae;hpb=2069e2eb3b62f3f5c20dd08158c8aacd2a2ea0da;p=citadel.git diff --git a/citadel/modules/pop3client/serv_pop3client.c b/citadel/modules/pop3client/serv_pop3client.c index 4fe026efa..81feca096 100644 --- a/citadel/modules/pop3client/serv_pop3client.c +++ b/citadel/modules/pop3client/serv_pop3client.c @@ -199,8 +199,10 @@ void DeletePOP3Aggregator(void *vptr) FreeStrBuf(&ptr->IO.SendBuf.Buf); FreeStrBuf(&ptr->IO.RecvBuf.Buf); DeleteAsyncMsg(&ptr->IO.ReadMsg); - ((struct CitContext*)ptr->IO.CitContext)->state = CON_IDLE; - ((struct CitContext*)ptr->IO.CitContext)->kill_me = 1; + if (((struct CitContext*)ptr->IO.CitContext)) { + ((struct CitContext*)ptr->IO.CitContext)->state = CON_IDLE; + ((struct CitContext*)ptr->IO.CitContext)->kill_me = 1; + } FreeAsyncIOContents(&ptr->IO); free(ptr); } @@ -330,6 +332,17 @@ eNextState POP3C_GetListOneLine(pop3aggr *RecvMsg) return eSendReply; } + + /* + * work around buggy pop3 servers which send + * empty lines in their listings. + */ + if ((StrLength(RecvMsg->IO.IOBuf) == 0) || + !isdigit(ChrPtr(RecvMsg->IO.IOBuf)[0])) + { + return eReadMore; + } + OneMsg = (FetchItem*) malloc(sizeof(FetchItem)); memset(OneMsg, 0, sizeof(FetchItem)); OneMsg->MSGID = atol(ChrPtr(RecvMsg->IO.IOBuf)); @@ -983,7 +996,7 @@ int pop3_do_fetching(pop3aggr *cpptr) /* * Scan a room's netconfig to determine whether it requires POP3 aggregation */ -void pop3client_scan_room(struct ctdlroom *qrbuf, void *data, const OneRoomNetCfg *OneRNCFG) +void pop3client_scan_room(struct ctdlroom *qrbuf, void *data, OneRoomNetCfg *OneRNCFG) { const RoomNetCfgLine *pLine; void *vptr; @@ -1081,6 +1094,7 @@ void pop3client_scan_room(struct ctdlroom *qrbuf, void *data, const OneRoomNetCf DeletePOP3Aggregator); pthread_mutex_unlock(&POP3QueueMutex); + pLine = pLine->next; } }