From 3f8d9844378e3ac23e93e8d9874f5ec01fcb3ef9 Mon Sep 17 00:00:00 2001 From: klm Date: Thu, 3 Sep 1998 18:36:16 +0000 Subject: Respect default limit on number of mail command lines for processing. (Large, misdirected mail commands can lead to near-thrash conditions, while the MailCommandHandler slogs through misguidedly trying to process too many lines...) --- Mailman/MailCommandHandler.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'Mailman/MailCommandHandler.py') diff --git a/Mailman/MailCommandHandler.py b/Mailman/MailCommandHandler.py index efd13e3e6..fc8ab6f08 100644 --- a/Mailman/MailCommandHandler.py +++ b/Mailman/MailCommandHandler.py @@ -120,14 +120,19 @@ class MailCommandHandler: else: self.AddError("Subject line ignored: %s" % subject) processed = {} # For avoiding redundancies. - for line in lines: - line = string.strip(line) + maxlines = mm_cfg.DEFAULT_MAIL_COMMANDS_MAX_LINES + for linecount in range(len(lines)): + line = string.strip(lines[linecount]) if not line: continue + if linecount > maxlines: + self.AddToResponse("\n") + self.AddError("Maximum command lines (%d) encountered," + " ignoring the rest..." % maxlines) + self.AddToResponse("<<< " + string.join(lines[linecount:], + "\n<<< ")) + break self.AddToResponse("\n>>>> %s" % line) - line = string.strip(line) - if not line: - continue args = string.split(line) cmd = string.lower(args[0]) args = args[1:] -- cgit v1.2.3-70-g09d2