From 014f9aec1c45d5c6384a11daf8820ccb1495aa9a Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Sat, 22 Jun 2002 21:10:04 +0000 Subject: More patches by Sunil. svn path=/trunk/; revision=3653 --- NEWS | 4 +++- driver.c | 5 +++-- sink.c | 26 ++++++++++++++++++++------ 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/NEWS b/NEWS index 23b9af15..04439706 100644 --- a/NEWS +++ b/NEWS @@ -11,7 +11,9 @@ * Scott Gifford's dotted-quad patch. * Updated Danish translation. * RPM now built with SSL and IPv6 support, reflecting what's in RH 7.3. -* Sunil Shetye's patch to send CAPA during POP3 sessions. +* Sunil Shetye's patches to send CAPA during POP3 sessions and improve + the PS_RETAINED behavior slightly. +* Yann Droneaud's fix to eliminate a socket leak on error. fetchmail-5.9.12 (Tue Jun 4 14:57:47 EDT 2002), 21669 lines: diff --git a/driver.c b/driver.c index 99e95d18..79ad4213 100644 --- a/driver.c +++ b/driver.c @@ -495,7 +495,7 @@ static int fetch_messages(int mailserver_socket, struct query *ctl, err = readheaders(mailserver_socket, len, msgsizes[num-1], ctl, num); if (err == PS_RETAINED) - suppress_forward = retained = TRUE; + suppress_readbody = suppress_forward = suppress_delete = retained = TRUE; else if (err == PS_TRANSIENT) suppress_delete = suppress_forward = TRUE; else if (err == PS_REFUSED) @@ -631,7 +631,8 @@ static int fetch_messages(int mailserver_socket, struct query *ctl, ctl->errcount++; suppress_delete = TRUE; } - (*fetches)++; + if (!retained) + (*fetches)++; } /* diff --git a/sink.c b/sink.c index e76c9d9c..ca2dc657 100644 --- a/sink.c +++ b/sink.c @@ -237,14 +237,25 @@ static int send_bouncemail(struct query *ctl, struct msgblk *msg, strcat(daemon_name, host_fqdn()); /* we need only SMTP for this purpose */ - if ((sock = SockOpen("localhost", SMTP_PORT, NULL, NULL)) == -1 - || SMTP_ok(sock) != SM_OK - || SMTP_helo(sock, fetchmailhost) != SM_OK - || SMTP_from(sock, daemon_name, (char *)NULL) != SM_OK - || SMTP_rcpt(sock, bounce_to) != SM_OK - || SMTP_data(sock) != SM_OK) + if ((sock = SockOpen("localhost", SMTP_PORT, NULL, NULL)) == -1) return(FALSE); + if (SMTP_ok(sock) != SM_OK) + { + SockClose(sock); + return FALSE; + } + + if (SMTP_helo(sock, fetchmailhost) != SM_OK + || SMTP_from(sock, daemon_name, (char *)NULL) != SM_OK + || SMTP_rcpt(sock, bounce_to) != SM_OK + || SMTP_data(sock) != SM_OK) + { + SMTP_quit(sock); + SockClose(sock); + return(FALSE); + } + /* our first duty is to keep the sacred foo counters turning... */ #ifdef HAVE_SNPRINTF snprintf(boundary, sizeof(boundary), @@ -334,7 +345,10 @@ static int send_bouncemail(struct query *ctl, struct msgblk *msg, SockPrintf(sock, "--%s--\r\n", boundary); if (SMTP_eom(sock) != SM_OK || SMTP_quit(sock)) + { + SockClose(sock); return(FALSE); + } SockClose(sock); -- cgit v1.2.3