Skip to content

Commit 7bf6ae4

Browse files
committed
update
1 parent 1e7d327 commit 7bf6ae4

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

Mailman/MailList.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ def __init__(self, name=None, lock=1):
9696
# pipe to the wrapper in an MTA alias or other delivery process
9797
# contains shell special characters so allow only defined characters
9898
# (default = '[-+_.=a-z0-9]').
99-
if len(re.sub(r'[%s]' % mm_cfg.ACCEPTABLE_LISTNAME_CHARACTERS.replace('-', r'\-'), '', name)) > 0:
99+
pattern = mm_cfg.ACCEPTABLE_LISTNAME_CHARACTERS.replace('-', r'\-')
100+
if len(re.sub(r'[%s]' % pattern, '', name)) > 0:
100101
raise Errors.BadListNameError(name)
101102
# Validate what will be the list's posting address
102103
postingaddr = '%s@%s' % (name, mm_cfg.DEFAULT_EMAIL_HOST)

Mailman/Queue/IncomingRunner.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -362,10 +362,16 @@ def _oneloop(self):
362362
import sys
363363
MailList = sys.modules['Mailman.MailList'].MailList
364364
mlist = MailList(listname, lock=0)
365-
except Errors.MMUnknownListError:
366-
mailman_log('error', 'IncomingRunner._oneloop: Unknown list %s', listname)
367-
self._shunt.enqueue(msg, msgdata)
368-
continue
365+
except (Errors.BadListNameError, Errors.MMUnknownListError) as e:
366+
# List doesn't exist or has invalid name - move message to bad queue
367+
mailman_log('error', 'List not found: %s - moving message to bad queue', listname)
368+
try:
369+
badq = get_switchboard(mm_cfg.BADQUEUE_DIR)
370+
badq.enqueue(msg, listname=listname, tolist=listname)
371+
return True
372+
except Exception as e:
373+
mailman_log('error', 'Failed to move message to bad queue: %s', str(e))
374+
return False
369375

370376
# Process the message
371377
result = self._dispose(mlist, msg, msgdata)

0 commit comments

Comments
 (0)