tmda-1.0.3

The previous posts about patches reminded me that I should at least
get this one into the mail archives.

I ran into a situation where a mis-configured PC e-mail client was
efectivly causing a DOS attack on tmda-ofmipd.

The error reported was
....
error: uncaptured python exception, closing channel
<__main__.TMDAProxy listening localhost:8025 at 0x81fddcc>
(socket.error:(22, 'Invalid argument')
[/opt/mt/python-2.3/lib/python2.3/asyncore.py|read|69]
[/opt/mt/python-2.3/lib/python2.3/asyncore.py|handle_read_event|384]
[/opt/sbin/tmda-ofmipd|handle_accept|1022] [<string>|getsockname|1])
....

The attached patch seems to keep tmda-ofmipd from crashing.

-- 
Tim Rice                                Multitalents    (707) 887-1469
[EMAIL PROTECTED]
--- tmda-1.0.3/bin/tmda-ofmipd.old      2004-05-04 10:22:25.000000000 -0700
+++ tmda-1.0.3/bin/tmda-ofmipd  2006-02-27 16:11:31.719798049 -0800
@@ -1019,10 +1019,13 @@
     def handle_accept(self):
         conn, addr = self.accept()
         print >> DEBUGSTREAM, 'Incoming connection from %s' % repr(addr)
-        locaddr = conn.getsockname()
-        self._localip = locaddr[0]
-        print >> DEBUGSTREAM, 'Incoming connection to %s' % repr(locaddr)
-        channel = SMTPChannel(self, conn, addr)
+        try:
+            locaddr = conn.getsockname()
+            self._localip = locaddr[0]
+            print >> DEBUGSTREAM, 'Incoming connection to %s' % repr(locaddr)
+            channel = SMTPChannel(self, conn, addr)
+        except socket.error, e:
+            print >> DEBUGSTREAM, 'got', e.__class__
 
     # API for "doing something useful with the message"
     def process_message(self, peer, mailfrom, rcpttos, data):
_________________________________________________
tmda-workers mailing list ([email protected])
http://tmda.net/lists/listinfo/tmda-workers

Reply via email to