aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS4
-rw-r--r--driver.c5
-rw-r--r--sink.c26
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);