summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSandesh Kumar Agrawal2013-01-11 19:32:48 +0530
committerSandesh Kumar Agrawal2013-01-11 19:32:48 +0530
commitc6dd23a544a552995fa4e0e22b8ae5c9dd8544c4 (patch)
treec18c1d59b280a9746e881fa294b3a945a5fb21f1 /src
parentf3ed2a32d103891d7b1062cddbc2e0ebe5cc1aa4 (diff)
downloadmailman-c6dd23a544a552995fa4e0e22b8ae5c9dd8544c4.tar.gz
mailman-c6dd23a544a552995fa4e0e22b8ae5c9dd8544c4.tar.zst
mailman-c6dd23a544a552995fa4e0e22b8ae5c9dd8544c4.zip
Diffstat (limited to 'src')
-rw-r--r--src/mailman/runners/lmtp.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mailman/runners/lmtp.py b/src/mailman/runners/lmtp.py
index e967f8965..0a51c534e 100644
--- a/src/mailman/runners/lmtp.py
+++ b/src/mailman/runners/lmtp.py
@@ -49,6 +49,7 @@ import asyncore
from email.utils import parseaddr
from zope.component import getUtility
+from mailman.interfaces.messages import IMessageStore
from mailman.config import config
from mailman.core.runner import Runner
@@ -97,6 +98,7 @@ ERR_501 = b'501 Message has defects'
ERR_502 = b'502 Error: command HELO not implemented'
ERR_550 = b'550 Requested action not taken: mailbox unavailable'
ERR_550_MID = b'550 No Message-ID header provided'
+ERR_DUP = b'Duplicate Message ID'
# XXX Blech
smtpd.__version__ = b'Python LMTP runner 1.0'
@@ -181,10 +183,13 @@ class LMTPRunner(Runner, smtpd.SMTPServer):
# Do basic post-processing of the message, checking it for defects or
# other missing information.
message_id = msg.get('message-id')
+ message_store = getUtility(IMessageStore)
if message_id is None:
return ERR_550_MID
if msg.defects:
return ERR_501
+ if message_store.get_message_by_id(message_id):
+ return ERR_DUP
msg.original_size = len(data)
add_message_hash(msg)
msg['X-MailFrom'] = mailfrom