From 3461698fa94f9f3e951c9c30ea4acf77201f7512 Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Mon, 21 Mar 2011 01:17:16 +0000
Subject: [PATCH] Ignore received SMTP messages when the sender disconnects
 before the acknowledgement ("250 OK") can be sent. In this case, the sender
 is either a spammer or it is a legitimate delivery attempt that has been
 aborted for some reason (e.g. timeout due to throttling).

---
 src/sbbs3/mailsrvr.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/sbbs3/mailsrvr.c b/src/sbbs3/mailsrvr.c
index 1770fd2102..5b0c858246 100644
--- a/src/sbbs3/mailsrvr.c
+++ b/src/sbbs3/mailsrvr.c
@@ -2461,6 +2461,11 @@ static void smtp_thread(void* arg)
 				lprintf(LOG_INFO,"%04d SMTP End of message (body: %lu lines, %lu bytes, header: %lu lines, %lu bytes)"
 					, socket, lines, ftell(msgtxt)-hdr_len, hdr_lines, hdr_len);
 
+				if(!socket_check(socket, NULL, NULL, 0)) {
+					lprintf(LOG_ERR,"%04d !SMTP sender disconnected (premature evacuation)", socket);
+					continue;
+				}
+
 				stats.msgs_received++;
 
 				/* Twit-listing (sender's name and e-mail addresses) here */
-- 
GitLab