diff -ur mailman-2.1.12.orig/Mailman/Defaults.py.in mailman-2.1.12/Mailman/Defaults.py.in --- mailman-2.1.12.orig/Mailman/Defaults.py.in 2009-08-05 14:08:56.000000000 +0200 +++ mailman-2.1.12/Mailman/Defaults.py.in 2009-08-07 12:31:28.000000000 +0200 @@ -1163,6 +1163,8 @@ DEFAULT_BOUNCE_NOTIFY_OWNER_ON_DISABLE = Yes DEFAULT_BOUNCE_NOTIFY_OWNER_ON_REMOVAL = Yes +# Default discard E-mails without valid commands in command mode +DEFAULT_DISCARD_EMAIL_WITHOUT_COMMAND = Yes ##### diff -ur mailman-2.1.12.orig/Mailman/MailList.py mailman-2.1.12/Mailman/MailList.py --- mailman-2.1.12.orig/Mailman/MailList.py 2009-02-23 22:23:35.000000000 +0100 +++ mailman-2.1.12/Mailman/MailList.py 2009-08-05 14:10:06.000000000 +0200 @@ -420,6 +420,9 @@ self.scrub_nondigest = mm_cfg.DEFAULT_SCRUB_NONDIGEST # automatic discarding self.max_days_to_hold = mm_cfg.DEFAULT_MAX_DAYS_TO_HOLD + # discards email with no command + self.discard_email_without_command = \ + mm_cfg.DEFAULT_DISCARD_EMAIL_WITHOUT_COMMAND # diff -ur mailman-2.1.12.orig/Mailman/Queue/CommandRunner.py mailman-2.1.12/Mailman/Queue/CommandRunner.py --- mailman-2.1.12.orig/Mailman/Queue/CommandRunner.py 2009-02-23 22:23:35.000000000 +0100 +++ mailman-2.1.12/Mailman/Queue/CommandRunner.py 2009-08-05 20:31:06.000000000 +0200 @@ -53,6 +53,10 @@ True = 1 False = 0 +# Enumerate return codes +CmdSuccess = 0 +CmdFailure = 1 +CmdMissing = 2 class Results: @@ -104,15 +108,19 @@ def process(self): # Now, process each line until we find an error. The first # non-command line found stops processing. - stop = False + found = CmdMissing + ret = CmdMissing for line in self.commands: if line and line.strip(): args = line.split() cmd = args.pop(0).lower() - stop = self.do_command(cmd, args) - self.lineno += 1 - if stop: + ret = self.do_command(cmd, args) + if ret != CmdMissing: + found = ret + if self.lineno > 0 and ret != CmdSuccess: break + self.lineno += 1 + return found def do_command(self, cmd, args=None): if args is None: @@ -135,7 +143,8 @@ self.subjcmdretried += 1 cmd = args.pop(0) return self.do_command(cmd, args) - return self.lineno <> 0 + # Unknown command: + return CmdMissing return handler.process(self, args) def send_response(self): @@ -234,18 +243,24 @@ # This message will have been delivered to one of mylist-request, # mylist-join, or mylist-leave, and the message metadata will contain # a key to which one was used. + ret = CmdMissing try: if msgdata.get('torequest'): - res.process() + ret = res.process() elif msgdata.get('tojoin'): - res.do_command('join') + ret = res.do_command('join') elif msgdata.get('toleave'): - res.do_command('leave') + ret = res.do_command('leave') elif msgdata.get('toconfirm'): mo = re.match(mm_cfg.VERP_CONFIRM_REGEXP, msg.get('to', '')) if mo: - res.do_command('confirm', (mo.group('cookie'),)) - res.send_response() - mlist.Save() + ret = res.do_command('confirm', (mo.group('cookie'),)) + if ret == CmdMissing and mlist.discard_email_without_command: + # Discard messages with no valid command + syslog('vette', 'No valid command, message discarded, msgid: %s', + msg.get('message-id', 'n/a')) + else: + res.send_response() + mlist.Save() finally: mlist.Unlock() diff -ur mailman-2.1.12.orig/Mailman/Version.py mailman-2.1.12/Mailman/Version.py --- mailman-2.1.12.orig/Mailman/Version.py 2009-02-23 22:23:35.000000000 +0100 +++ mailman-2.1.12/Mailman/Version.py 2009-08-07 12:55:02.000000000 +0200 @@ -37,7 +37,7 @@ (REL_LEVEL << 4) | (REL_SERIAL << 0)) # config.pck schema version number -DATA_FILE_VERSION = 97 +DATA_FILE_VERSION = 98 # qfile/*.db schema version number QFILE_SCHEMA_VERSION = 3 diff -ur mailman-2.1.12.orig/Mailman/versions.py mailman-2.1.12/Mailman/versions.py --- mailman-2.1.12.orig/Mailman/versions.py 2009-02-23 22:23:35.000000000 +0100 +++ mailman-2.1.12/Mailman/versions.py 2009-08-05 14:26:59.000000000 +0200 @@ -414,6 +414,9 @@ mm_cfg.DEFAULT_REGULAR_EXCLUDE_LISTS) add_only_if_missing('regular_include_lists', mm_cfg.DEFAULT_REGULAR_INCLUDE_LISTS) + # discards email with no command + add_only_if_missing('discard_email_without_command', + mm_cfg.DEFAULT_DISCARD_EMAIL_WITHOUT_COMMAND)