Dave,

Are you getting like 50+ copies of the exact same email?  If so it may not
be the spammer that is doing that to you, but a minor glitch in TMDA that
doesn't handle some forms of malformed email messages.  Here's a diff of the
changes made to the Generator.py module to fix this:

----[Snip Here]--- 
--- Generator.v1.0.2.py 2004-08-25 11:55:25.000000000 -0700
+++ Generator.py        2004-08-25 11:50:54.000000000 -0700
@@ -197,7 +197,15 @@
         if cset is not None:
             payload = cset.body_encode(payload)
         if not _isstring(payload):
-            raise TypeError, 'string payload expected: %s' % type(payload)
+            #raise TypeError, 'string payload expected: %s' % type(payload)
+            # AGW start
+            # Changed to handle malformed messages with a text base
+            # type and a multipart content
+            if type(payload) == type([]) and msg.is_multipart():
+                return self._handle_multipart(msg)
+            else:
+                raise TypeError, 'string payload expected: %s' %
type(payload)
+            # AGW end
         if self._mangle_from_:
             payload = fcre.sub('>From ', payload)
         self._fp.write(payload)
----[Snip Here]--- 

I was getting about 50+ emails all exactly the same in my pending queue
before I put this patch into place.  The issues was that the email was
getting copied into the pending queue, then was hitting this piece of code
at which point the malformed email caused an error to be raised which
deferred the delivery of the email.  As a result of the error being raised
no confirmation messages where ever sent for these malformed messages and my
local MTA (qmail at that time) would keep trying to re-deliver the same
email over and over adding a new copy to my pending queue each time it tried
until the email reached the end of it's retry time to live (I think about 3
days on my server).

Dave



-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Dave Cinege
Sent: Thursday, January 06, 2005 2:01 PM
To: [email protected]
Subject: ANNOUNCE: tmda_purgedups

Takes the output from tmda-pending, and creates a list of messages for 
deletion based on how many times the sender name or subject is duplicated 
according to a configurable threshold. Optionally calls tmda-pending to do 
the deletion itself.

I wrote this because I'm sick of getting spam bombs of dozens of messages,
the
result of which is I delete the entire pending queue instead of reviewing
it. 
(A better option would be for TMDA to intelligently handle this itself.)

Requires 'subprocess.py' included with Python 2.4. (Otherwise it works with 
Python 2.3, if you add that modules to site-packages)

I am cronning it daily. No extensive testing thus far. Seems to work. YMMV.

Dave
----
# tmda_purgedups.py --help
usage: Usage: tmda_purgedups.py [options] file|dir ...

options:
  --version             show program's version number and exit
  -h, --help            show this help message and exit
  -v, --verbose         Verbose output enabled.
  -s, --summary         Print summary at completion to stderr.
  -FFROM_MIN, --from-min=FROM_MIN
                        Minmum "From" duplicates required to count.
  -SSUBJECT_MIN, --subject-min=SUBJECT_MIN
                        Minmum "Subject" duplicates required to count.
  -T, --tmda-delete     Call tmda pending directly to delete messages
instead 
of
                        printing them.
  -B, --blacklist       If deleting directly, also Blacklist message sender.
  -p, --pretend         Do not actually delete messages.
-----
_____________________________________________
tmda-users mailing list ([email protected])
http://tmda.net/lists/listinfo/tmda-users

Reply via email to