diff -Naur fetchmail-6.2.3.orig/driver.c fetchmail-6.2.3/driver.c --- fetchmail-6.2.3.orig/driver.c 2003-07-17 07:26:11.000000000 +0530 +++ fetchmail-6.2.3/driver.c 2003-07-26 12:31:30.000000000 +0530 @@ -69,8 +69,8 @@ flag peek_capable; /* can we peek for better error recovery? */ int mailserver_socket_temp = -1; /* socket to free if connect timeout */ -static int timeoutcount; /* count consecutive timeouts */ -static int idletimeout; /* timeout occured in idle stage? */ +volatile static int timeoutcount = 0; /* count consecutive timeouts */ +volatile static int idletimeout = 0; /* timeout occured in idle stage? */ static jmp_buf restart; @@ -80,6 +80,11 @@ return idletimeout; } +void resetidletimeout(void) +{ + idletimeout = 0; +} + void set_timeout(int timeleft) /* reset the nonresponse-timeout */ { @@ -89,8 +94,6 @@ if (timeleft == 0) timeoutcount = 0; - idletimeout = 1; - ntimeout.it_interval.tv_sec = ntimeout.it_interval.tv_usec = 0; ntimeout.it_value.tv_sec = timeleft; ntimeout.it_value.tv_usec = 0; @@ -428,7 +431,10 @@ if (msgcodes[num-1] < 0) { if ((msgcodes[num-1] == MSGLEN_TOOLARGE) && !check_only) + { mark_oversized(ctl, num, msgsizes[num-1]); + suppress_delete = TRUE; + } /* To avoid flooding the syslog when using --keep, * report "Skipped message" only when: * 1) --verbose is on, or @@ -468,6 +474,7 @@ else { flag wholesize = !ctl->server.base_protocol->fetch_body; + flag separatefetchbody = (ctl->server.base_protocol->fetch_body) ? TRUE : FALSE; /* request a message */ err = (ctl->server.base_protocol->fetch_headers)(mailserver_socket,ctl,num, &len); @@ -509,39 +516,23 @@ * output sink. */ err = readheaders(mailserver_socket, len, msgsizes[num-1], - ctl, num); + ctl, num, + /* pass the suppress_readbody flag only if the underlying + * protocol does not fetch the body separately */ + separatefetchbody ? 0 : &suppress_readbody); if (err == PS_RETAINED) - { suppress_forward = suppress_delete = retained = TRUE; - suppress_readbody = TRUE; - } else if (err == PS_TRANSIENT) - { suppress_delete = suppress_forward = TRUE; - suppress_readbody = TRUE; - } else if (err == PS_REFUSED) - { suppress_forward = TRUE; - suppress_readbody = TRUE; - } else if (err == PS_TRUNCATED) - { suppress_readbody = TRUE; - len = 0; /* suppress body processing */ - } else if (err) return(err); - /* - * If we're using IMAP4 or something else that - * can fetch headers separately from bodies, - * it's time to request the body now. This - * fetch may be skipped if we got an anti-spam - * or other PS_REFUSED error response during - * readheaders. - */ - if (ctl->server.base_protocol->fetch_body && !suppress_readbody) + /* tell server we got it OK and resynchronize */ + if (separatefetchbody && ctl->server.base_protocol->trail) { if (outlevel >= O_VERBOSE && !isafile(1)) { @@ -551,9 +542,27 @@ if ((err = (ctl->server.base_protocol->trail)(mailserver_socket, ctl, num))) return(err); - len = 0; - if (!suppress_forward) + } + + /* do not read the body which is not being forwarded only if + * the underlying protocol allows the body to be fetched + * separately */ + if (separatefetchbody && suppress_forward) + suppress_readbody = TRUE; + + /* + * If we're using IMAP4 or something else that + * can fetch headers separately from bodies, + * it's time to request the body now. This + * fetch may be skipped if we got an anti-spam + * or other PS_REFUSED error response during + * readheaders. + */ + if (!suppress_readbody) + { + if (separatefetchbody) { + len = -1; if ((err=(ctl->server.base_protocol->fetch_body)(mailserver_socket,ctl,num,&len))) return(err); /* @@ -569,22 +578,12 @@ report_complete(stdout, GT_(" (%d body octets) "), len); } - } - /* process the body now */ - if (len > 0) - { - if (suppress_readbody) - { - err = PS_SUCCESS; - } - else - { - err = readbody(mailserver_socket, - ctl, - !suppress_forward, - len); - } + /* process the body now */ + err = readbody(mailserver_socket, + ctl, + !suppress_forward, + len); if (err == PS_TRANSIENT) suppress_delete = suppress_forward = TRUE; else if (err) @@ -669,7 +668,8 @@ } else if (ctl->server.base_protocol->delete && !suppress_delete - && ((msgcodes[num-1] >= 0) ? !ctl->keep : ctl->flush)) + && ((msgcodes[num-1] >= 0 && !ctl->keep) + || (msgcodes[num-1] == MSGLEN_OLD && ctl->flush))) { (*deletions)++; if (outlevel > O_SILENT) diff -Naur fetchmail-6.2.3.orig/fetchmail.h fetchmail-6.2.3/fetchmail.h --- fetchmail-6.2.3.orig/fetchmail.h 2003-07-17 20:56:50.000000000 +0530 +++ fetchmail-6.2.3/fetchmail.h 2003-07-26 12:31:30.000000000 +0530 @@ -94,7 +94,6 @@ #define PS_BSMTP 12 /* output batch could not be opened */ #define PS_MAXFETCH 13 /* poll ended by fetch limit */ #define PS_SERVBUSY 14 /* server is busy */ -#define PS_IDLETIMEOUT 15 /* timeout on imap IDLE */ /* leave space for more codes */ #define PS_UNDEFINED 23 /* something I hadn't thought of */ #define PS_TRANSIENT 24 /* transient failure (internal use) */ @@ -102,6 +101,7 @@ #define PS_RETAINED 26 /* message retained (internal use) */ #define PS_TRUNCATED 27 /* headers incomplete (internal use) */ #define PS_REPOLL 28 /* repoll immediately with changed parameters (internal use) */ +#define PS_IDLETIMEOUT 29 /* timeout on imap IDLE (internal use) */ /* output noise level */ #define O_SILENT 0 /* mute, max squelch, etc. */ @@ -429,6 +429,7 @@ /* driver.c -- main driver loop */ void set_timeout(int); int isidletimeout(void); +void resetidletimeout(void); int do_protocol(struct query *, const struct method *); /* transact.c: transaction support */ @@ -437,7 +438,8 @@ long fetchlen, long reallen, struct query *ctl, - int num); + int num, + flag *suppress_readbody); int readbody(int sock, struct query *ctl, flag forward, int len); #if defined(HAVE_STDARG_H) void gen_send(int sock, const char *, ... ) diff -Naur fetchmail-6.2.3.orig/imap.c fetchmail-6.2.3/imap.c --- fetchmail-6.2.3.orig/imap.c 2003-07-17 06:33:20.000000000 +0530 +++ fetchmail-6.2.3/imap.c 2003-07-26 12:40:58.000000000 +0530 @@ -298,6 +298,8 @@ if (outlevel >= O_VERBOSE) report(stdout, GT_("will idle after poll\n")); } + + peek_capable = (imap_version >= IMAP4); } static int imap_getauth(int sock, struct query *ctl, char *greeting) @@ -308,6 +310,15 @@ flag did_stls = FALSE; #endif /* SSL_ENABLE */ + /* + * Assumption: expunges are cheap, so we want to do them + * after every message unless user said otherwise. + */ + if (NUM_SPECIFIED(ctl->expunge)) + expunge_period = NUM_VALUE_OUT(ctl->expunge); + else + expunge_period = 1; + capa_probe(sock, ctl); /* @@ -319,44 +330,6 @@ preauth = FALSE; /* reset for the next session */ return(PS_SUCCESS); } - /* - * Time to authenticate the user. - * Try the protocol variants that don't require passwords first. - */ - ok = PS_AUTHFAIL; - -#ifdef GSSAPI - if ((ctl->server.authenticate == A_ANY - || ctl->server.authenticate == A_GSSAPI) - && strstr(capabilities, "AUTH=GSSAPI")) - if(ok = do_gssauth(sock, "AUTHENTICATE", ctl->server.truename, ctl->remotename)) - { - /* SASL cancellation of authentication */ - gen_send(sock, "*"); - if(ctl->server.authenticate != A_ANY) - return ok; - } - else - return ok; -#endif /* GSSAPI */ - -#ifdef KERBEROS_V4 - if ((ctl->server.authenticate == A_ANY - || ctl->server.authenticate == A_KERBEROS_V4 - || ctl->server.authenticate == A_KERBEROS_V5) - && strstr(capabilities, "AUTH=KERBEROS_V4")) - { - if ((ok = do_rfc1731(sock, "AUTHENTICATE", ctl->server.truename))) - { - /* SASL cancellation of authentication */ - gen_send(sock, "*"); - if(ctl->server.authenticate != A_ANY) - return ok; - } - else - return ok; - } -#endif /* KERBEROS_V4 */ #ifdef SSL_ENABLE if ((!ctl->sslproto || !strcmp(ctl->sslproto,"tls1")) @@ -400,16 +373,44 @@ } #endif /* SSL_ENABLE */ - peek_capable = (imap_version >= IMAP4); - - /* - * Assumption: expunges are cheap, so we want to do them - * after every message unless user said otherwise. + /* + * Time to authenticate the user. + * Try the protocol variants that don't require passwords first. */ - if (NUM_SPECIFIED(ctl->expunge)) - expunge_period = NUM_VALUE_OUT(ctl->expunge); - else - expunge_period = 1; + ok = PS_AUTHFAIL; + +#ifdef GSSAPI + if ((ctl->server.authenticate == A_ANY + || ctl->server.authenticate == A_GSSAPI) + && strstr(capabilities, "AUTH=GSSAPI")) + if(ok = do_gssauth(sock, "AUTHENTICATE", ctl->server.truename, ctl->remotename)) + { + /* SASL cancellation of authentication */ + gen_send(sock, "*"); + if(ctl->server.authenticate != A_ANY) + return ok; + } + else + return ok; +#endif /* GSSAPI */ + +#ifdef KERBEROS_V4 + if ((ctl->server.authenticate == A_ANY + || ctl->server.authenticate == A_KERBEROS_V4 + || ctl->server.authenticate == A_KERBEROS_V5) + && strstr(capabilities, "AUTH=KERBEROS_V4")) + { + if ((ok = do_rfc1731(sock, "AUTHENTICATE", ctl->server.truename))) + { + /* SASL cancellation of authentication */ + gen_send(sock, "*"); + if(ctl->server.authenticate != A_ANY) + return ok; + } + else + return ok; + } +#endif /* KERBEROS_V4 */ /* * No such luck. OK, now try the variants that mask your password diff -Naur fetchmail-6.2.3.orig/pop3.c fetchmail-6.2.3/pop3.c --- fetchmail-6.2.3.orig/pop3.c 2003-07-17 20:46:58.000000000 +0530 +++ fetchmail-6.2.3/pop3.c 2003-07-26 12:31:30.000000000 +0530 @@ -224,6 +224,17 @@ { int ok; +#if defined(GSSAPI) + has_gssapi = FALSE; +#endif /* defined(GSSAPI) */ +#if defined(KERBEROS_V4) || defined(KERBEROS_V5) + has_kerberos = FALSE; +#endif /* defined(KERBEROS_V4) || defined(KERBEROS_V5) */ + has_cram = FALSE; +#ifdef OPIE_ENABLE + has_otp = FALSE; +#endif /* OPIE_ENABLE */ + ok = gen_transact(sock, "CAPA"); if (ok == PS_SUCCESS) { @@ -270,6 +281,20 @@ flag did_stls = FALSE; #endif /* SSL_ENABLE */ +#if defined(GSSAPI) + has_gssapi = FALSE; +#endif /* defined(GSSAPI) */ +#if defined(KERBEROS_V4) || defined(KERBEROS_V5) + has_kerberos = FALSE; +#endif /* defined(KERBEROS_V4) || defined(KERBEROS_V5) */ + has_cram = FALSE; +#ifdef OPIE_ENABLE + has_otp = FALSE; +#endif /* OPIE_ENABLE */ +#ifdef SSL_ENABLE + has_ssl = FALSE; +#endif /* SSL_ENABLE */ + if (ctl->server.authenticate == A_SSH) { return PS_SUCCESS; } @@ -342,7 +367,7 @@ */ if (ctl->server.authenticate == A_ANY) { - if (capa_probe(sock) != PS_SUCCESS) + if ((ok = capa_probe(sock)) != PS_SUCCESS) /* we are in STAGE_GETAUTH! */ if (ok == PS_AUTHFAIL || /* Some servers directly close the socket. However, if we diff -Naur fetchmail-6.2.3.orig/sink.c fetchmail-6.2.3/sink.c --- fetchmail-6.2.3.orig/sink.c 2003-07-17 20:49:56.000000000 +0530 +++ fetchmail-6.2.3/sink.c 2003-07-26 12:31:30.000000000 +0530 @@ -73,6 +73,11 @@ char *parsed_host = NULL; /* maybe it's time to close the socket in order to force delivery */ + if (last_smtp_ok > 0 && time((time_t *)NULL) - last_smtp_ok > mytimeout) + { + smtp_close(ctl, 1); + last_smtp_ok = 0; + } if (NUM_NONZERO(ctl->batchlimit)) { if (batchcount == ctl->batchlimit) smtp_close(ctl, 1); @@ -270,7 +275,7 @@ strcmp(msg->return_path, "<>") == 0 || strcasecmp(msg->return_path, md1) == 0 || strncasecmp(msg->return_path, md2, strlen(md2)) == 0) - return(FALSE); + return(TRUE); bounce_to = (run.bouncemail ? msg->return_path : run.postmaster); @@ -511,10 +516,12 @@ default: /* bounce non-transient errors back to the sender */ if (smtperr >= 500 && smtperr <= 599) - if (send_bouncemail(ctl, msg, XMIT_ACCEPT, + { + send_bouncemail(ctl, msg, XMIT_ACCEPT, "General SMTP/ESMTP error.\r\n", - 1, responses)) - return(run.bouncemail ? PS_REFUSED : PS_TRANSIENT); + 1, responses); + return(PS_REFUSED); + } /* * We're going to end up here on 4xx errors, like: * @@ -847,6 +854,9 @@ } else if (strchr(msg->return_path,'@') || strchr(msg->return_path,'!')) ap = msg->return_path; + /* in case Return-Path was "<>" we want to preserve that */ + else if (strcmp(msg->return_path,"<>") == 0) + ap = msg->return_path; else /* in case Return-Path existed but was local */ { if (is_dottedquad(ctl->server.truename)) diff -Naur fetchmail-6.2.3.orig/smtp.c fetchmail-6.2.3/smtp.c --- fetchmail-6.2.3.orig/smtp.c 2003-07-17 06:33:20.000000000 +0530 +++ fetchmail-6.2.3/smtp.c 2003-07-26 12:31:30.000000000 +0530 @@ -87,7 +87,7 @@ SockPrintf(sock, "AUTH CRAM-MD5\r\n"); SockRead(sock, smtp_response, sizeof(smtp_response) - 1); strncpy(tmp, smtp_response, sizeof(tmp)); - tmp[sizeof(tmp)-1] == '\0'; + tmp[sizeof(tmp)-1] = '\0'; if (strncmp(tmp, "334 ", 4)) { /* Server rejects AUTH */ SMTP_auth_error(sock, GT_("Server rejected the AUTH command.\n")); @@ -147,7 +147,7 @@ SockPrintf(sock, "AUTH LOGIN\r\n"); SockRead(sock, smtp_response, sizeof(smtp_response) - 1); strncpy(tmp, smtp_response, sizeof(tmp)); - tmp[sizeof(tmp)-1] == '\0'; + tmp[sizeof(tmp)-1] = '\0'; if (strncmp(tmp, "334 ", 4)) { /* Server rejects AUTH */ SMTP_auth_error(sock, GT_("Server rejected the AUTH command.\n")); @@ -164,7 +164,7 @@ SockPrintf(sock, "%s\r\n", b64buf); SockRead(sock, smtp_response, sizeof(smtp_response) - 1); strncpy(tmp, smtp_response, sizeof(tmp)); - tmp[sizeof(tmp)-1] == '\0'; + tmp[sizeof(tmp)-1] = '\0'; p = strchr(tmp, ' '); if (!p) { SMTP_auth_error(sock, GT_("Bad base64 reply from server.\n")); @@ -213,7 +213,7 @@ *opt |= hp->value; if (strncmp(hp->name, "AUTH ", 5) == 0) strncpy(auth_response, smtp_response, sizeof(auth_response)); - auth_response[sizeof(auth_response)-1] == '\0'; + auth_response[sizeof(auth_response)-1] = '\0'; } if ((smtp_response[0] == '1' || smtp_response[0] == '2' || smtp_response[0] == '3') && smtp_response[3] == ' ') { if (*opt & ESMTP_AUTH) @@ -327,6 +327,8 @@ return ok; } +time_t last_smtp_ok = 0; + int SMTP_ok(int sock) /* returns status of SMTP connection */ { @@ -360,6 +362,8 @@ return SM_UNRECOVERABLE; } + last_smtp_ok = time((time_t *) NULL); + if ((smtp_response[0] == '1' || smtp_response[0] == '2' || smtp_response[0] == '3') && smtp_response[3] == ' ') return SM_OK; diff -Naur fetchmail-6.2.3.orig/smtp.h fetchmail-6.2.3/smtp.h --- fetchmail-6.2.3.orig/smtp.h 2003-07-17 06:33:20.000000000 +0530 +++ fetchmail-6.2.3/smtp.h 2003-07-26 12:31:30.000000000 +0530 @@ -7,6 +7,8 @@ #ifndef _POPSMTP_ #define _POPSMTP_ +#include + #define SMTPBUFSIZE 256 /* SMTP error values */ @@ -21,6 +23,8 @@ #define ESMTP_ATRN 0x08 /* used with ODMR, RFC 2645 */ #define ESMTP_AUTH 0x10 +extern time_t last_smtp_ok; + void SMTP_setmode(char); int SMTP_helo(int socket,const char *host); int SMTP_ehlo(int socket,const char *host, char *name, char *passwd, int *opt); diff -Naur fetchmail-6.2.3.orig/socket.c fetchmail-6.2.3/socket.c --- fetchmail-6.2.3.orig/socket.c 2003-07-17 20:49:01.000000000 +0530 +++ fetchmail-6.2.3/socket.c 2003-07-26 12:31:30.000000000 +0530 @@ -973,7 +973,7 @@ SSL_set_fd(_ssl_context[sock], sock); - if(SSL_connect(_ssl_context[sock]) == -1) { + if(SSL_connect(_ssl_context[sock]) < 1) { ERR_print_errors_fp(stderr); return(-1); } diff -Naur fetchmail-6.2.3.orig/transact.c fetchmail-6.2.3/transact.c --- fetchmail-6.2.3.orig/transact.c 2003-07-17 21:07:13.000000000 +0530 +++ fetchmail-6.2.3/transact.c 2003-07-26 12:31:30.000000000 +0530 @@ -352,13 +352,15 @@ long fetchlen, long reallen, struct query *ctl, - int num) + int num, + flag *suppress_readbody) /* read message headers and ship to SMTP or MDA */ /* sock: to which the server is connected */ /* fetchlen: length of message according to fetch response */ /* reallen: length of message according to getsizes */ /* ctl: query control record */ /* num: index of message */ +/* suppress_readbody: whether call to readbody() should be supressed */ { struct addrblk { @@ -379,13 +381,13 @@ int n, linelen, oldlen, ch, remaining, skipcount; struct idlist *idp; flag no_local_matches = FALSE; - flag headers_ok, has_nuls; + flag has_nuls; int olderrs, good_addresses, bad_addresses; - int retain_mail = 0; + int retain_mail = 0, refuse_mail = 0; flag already_has_return_path = FALSE; sizeticker = 0; - has_nuls = headers_ok = FALSE; + has_nuls = FALSE; msgblk.return_path[0] = '\0'; olderrs = ctl->errcount; @@ -419,7 +421,7 @@ for (remaining = fetchlen; remaining > 0 || protocol->delimited; ) { - char *line; + char *line, *rline; int overlong = FALSE; line = xmalloc(sizeof(buf)); @@ -446,7 +448,13 @@ */ if ( n && buf[n-1] != '\n' ) { overlong = TRUE; - line = realloc(line, linelen); + rline = (char *) realloc(line, linelen); + if (rline == NULL) + { + free (line); + return(PS_IOERR); + } + line = rline; memcpy(line + linelen - n, buf, n); ch = ' '; /* So the next iteration starts */ continue; @@ -458,7 +466,13 @@ if (ctl->forcecr && buf[n-1] == '\n' && (n == 1 || buf[n-2] != '\r')) { char * tcp; - line = (char *) realloc(line, linelen + 2); + rline = (char *) realloc(line, linelen + 2); + if (rline == NULL) + { + free (line); + return(PS_IOERR); + } + line = rline; memcpy(line + linelen - n, buf, n - 1); tcp = line + linelen - 1; *tcp++ = '\r'; @@ -469,15 +483,21 @@ } else { - line = (char *) realloc(line, linelen + 1); + rline = (char *) realloc(line, linelen + 1); + if (rline == NULL) + { + free (line); + return(PS_IOERR); + } + line = rline; memcpy(line + linelen - n, buf, n + 1); } /* check for end of headers */ if (end_of_header(line)) { - headers_ok = TRUE; - has_nuls = (linelen != strlen(line)); + if (linelen != strlen (line)) + has_nuls = TRUE; free(line); goto process_headers; } @@ -489,8 +509,13 @@ */ if (protocol->delimited && line[0] == '.' && EMPTYLINE(line+1)) { - headers_ok = FALSE; - has_nuls = (linelen != strlen(line)); + if (outlevel > O_SILENT) + report(stdout, + GT_("message delimiter found while scanning headers\n")); + if (suppress_readbody) + *suppress_readbody = TRUE; + if (linelen != strlen (line)) + has_nuls = TRUE; free(line); goto process_headers; } @@ -499,17 +524,18 @@ * At least one brain-dead website (netmind.com) is known to * send out robotmail that's missing the RFC822 delimiter blank * line before the body! Without this check fetchmail segfaults. - * With it, we treat such messages as though they had the missing - * blank line. + * With it, we treat such messages as spam and refuse them. */ - if (!isspace(line[0]) && !strchr(line, ':')) + if (!refuse_mail && !isspace(line[0]) && !strchr(line, ':')) { - headers_ok = FALSE; - has_nuls = (linelen != strlen(line)); + if (linelen != strlen (line)) + has_nuls = TRUE; if (outlevel > O_SILENT) report(stdout, GT_("incorrect header line found while scanning headers\n")); - goto process_headers; + if (outlevel >= O_VERBOSE) + report (stdout, GT_("line: %s"), line); + refuse_mail = 1; } /* check for RFC822 continuations */ @@ -550,8 +576,16 @@ } + /* skip processing if we are going to retain or refuse this mail */ + if (retain_mail || refuse_mail) + { + free(line); + continue; + } + /* we see an ordinary (non-header, non-message-delimiter line */ - has_nuls = (linelen != strlen(line)); + if (linelen != strlen (line)) + has_nuls = TRUE; /* save the message's ID, we may use it for killing duplicates later */ if (MULTIDROP(ctl) && !strncasecmp(line, "Message-ID:", 11)) @@ -691,6 +725,8 @@ if ((already_has_return_path==FALSE) && !strncasecmp("Return-Path:", line, 12) && (cp = nxtaddr(line))) { already_has_return_path = TRUE; + if (cp[0]=='\0') /* nxtaddr() strips the brackets... */ + cp="<>"; strncpy(msgblk.return_path, cp, sizeof(msgblk.return_path)); msgblk.return_path[sizeof(msgblk.return_path)-1] = '\0'; if (!ctl->mda) { @@ -701,9 +737,10 @@ if (!msgblk.headers) { - oldlen = strlen(line); + oldlen = linelen; msgblk.headers = xmalloc(oldlen + 1); - (void) strcpy(msgblk.headers, line); + (void) memcpy(msgblk.headers, line, linelen); + msgblk.headers[oldlen] = '\0'; free(line); line = msgblk.headers; } @@ -712,14 +749,15 @@ char *newhdrs; int newlen; - newlen = oldlen + strlen(line); + newlen = oldlen + linelen; newhdrs = (char *) realloc(msgblk.headers, newlen + 1); if (newhdrs == NULL) { free(line); return(PS_IOERR); } msgblk.headers = newhdrs; - strcpy(msgblk.headers + oldlen, line); + memcpy(msgblk.headers + oldlen, line, linelen); + msgblk.headers[newlen] = '\0'; free(line); line = msgblk.headers + oldlen; oldlen = newlen; @@ -831,6 +869,8 @@ msgblk.headers = NULL; return(PS_RETAINED); } + if (refuse_mail) + return(PS_REFUSED); /* * When mail delivered to a multidrop mailbox on the server is * addressed to multiple people on the client machine, there will @@ -1255,14 +1295,6 @@ *cp++ = '\0'; stuffline(ctl, buf); - if (!headers_ok) - { - if (outlevel > O_SILENT) - report(stdout, - GT_("message delimiter found while scanning headers\n")); - return(PS_TRUNCATED); - } - return(PS_SUCCESS); } @@ -1457,7 +1489,10 @@ set_timeout(0); phase = oldphase; if(isidletimeout()) + { + resetidletimeout(); return(PS_IDLETIMEOUT); + } else return(PS_SOCKET); } diff -Naur fetchmail-6.2.3.orig/uid.c fetchmail-6.2.3/uid.c --- fetchmail-6.2.3.orig/uid.c 2003-07-17 06:33:20.000000000 +0530 +++ fetchmail-6.2.3/uid.c 2003-07-26 12:31:30.000000000 +0530 @@ -135,19 +135,16 @@ * espescially if the POP server returns an X-UIDL header * instead of a Message-ID, as GMX's (www.gmx.net) POP3 * StreamProxy V1.0 does. + * + * this is one other trick. The userhost part + * may contain ' ' in the user part, at least in + * the lotus notes case. + * So we start looking for the '@' after which the + * host will follow with the ' ' seperator finaly id. */ - if ((id = strchr(user, ' ')) != NULL ) + if ((delimp1 = strchr(user, '@')) != NULL && + (id = strchr(delimp1,' ')) != NULL) { - - /* - * this is one other trick. The userhost part - * may contain ' ' in the user part, at least in - * the lotus notes case. - * So we start looking for the '@' after which the - * host will follow with the ' ' seperator finaly id. - */ - delimp1 = strchr(user, '@'); - id = strchr(delimp1,' '); for (delimp1 = id; delimp1 >= user; delimp1--) if ((*delimp1 != ' ') && (*delimp1 != '\t')) break;