[Mailman-Developers] [Patch] SMTPDirect.py wrongly closing the connection

Marc MERLIN marc_news@vasoftware.com
Wed, 12 Dec 2001 23:15:35 -0800


So, I have my mailman alpha 3 cvs with python 2.1 seemingly working, and
when I move a list with more than one subscriber to it, I started getting:
Dec 12 22:11:33 2001 (18247) delivery to aregnier@yahoo.com failed with code 501
: <powerteam-bounces@lists.merlins.org> size=3426: malformed address: size=3426
may not follow <powerteam-bounces@lists.merlins.org>

Apparently smtplib.py  makes a delivery  attempt without doing EHLO  or HELO
first, and then  users the size extention, which is  illegal before EHLO has
been used.

I have the following defaults:
SMTP_MAX_RCPTS = 500
MAX_DELIVERY_THREADS = 0
SMTPHOST = 'localhost'
SMTPPORT = 0 

My exim debug logs show:

This one is good:
SMTP>> 220 mail2.merlins.org ESMTP Exim 3.31-VA-mm2 #1 Wed, 12 Dec 2001 22:28:08
SMTP<< ehlo moremagic.merlins.org
SMTP>> 250-mail2.merlins.org Hello mailman at localhost [127.0.0.1]
250-SIZE 52428800
250-EXPN
250-PIPELINING
250-STARTTLS
250 HELP
SMTP<< mail FROM:<powerteam-bounces@lists.merlins.org> size=3426
SMTP>> 250 <powerteam-bounces@lists.merlins.org> is syntactically correct
SMTP<< rcpt TO:<tinic@tinic.net>
SMTP>> 250 <tinic@tinic.net> is syntactically correct
SMTP<< rcpt TO:<marc@merlins.org>
SMTP>> 250 <marc@merlins.org> is syntactically correct
SMTP<< data
SMTP>> 354 Enter message, ending with "." on a line by itself
(message follows)
SMTP>> 250 OK id=16EPLk-0000fZ-00
SMTP<< quit
SMTP>> 221 mail2.merlins.org closing connection


But here's what happens afterwards.

LOG: 4 MAIN
  SMTP connection from localhost [127.0.0.1]
SMTP>> 220 mail2.merlins.org ESMTP Exim 3.31-VA-mm2 #1 Wed, 12 Dec 2001 22:28:08
 -0800 - mm1
SMTP<< mail FROM:<powerteam-bounces@lists.merlins.org> size=3426
LOG: 4 MAIN
  SMTP syntax error in "mail FROM:<powerteam-bounces@lists.merlins.org> size=342
6" H=localhost [127.0.0.1] U=mailman: malformed address: size=3426 may not follo
w <powerteam-bounces@lists.merlins.org> 
SMTP>> 501 <powerteam-bounces@lists.merlins.org> size=3426: malformed address: s
ize=3426 may not follow <powerteam-bounces@lists.merlins.org> 
SMTP<< rset
SMTP>> 250 Reset OK
SMTP<< quit

So here, mailman becomes rude, and doesn't say EHLO, and yet tries to use
SIZE...

(one hoyr later)
Aaaah, I think I get it.

moremagic:/var/local/mailman/logs# diff -u /var/local/src/mailman/Mailman/Handlers/SMTPDirect.py ../Mailman/Handlers/SMTPDirect.py 
--- /var/local/src/mailman/Mailman/Handlers/SMTPDirect.py       Wed Nov 21 14:57:27 2001
+++ ../Mailman/Handlers/SMTPDirect.py   Wed Dec 12 23:05:02 2001
@@ -274,7 +274,8 @@
             # constructor if SMTPHOST is false
             refused = conn.sendmail(envsender, recips, msgtext)
         finally:
-            conn.quit()
+           1
+            #conn.quit()
     except smtplib.SMTPRecipientsRefused, e:
         refused = e.recipients
     # MTA not responding, or other socket problems, or any other kind of

I'm not  100% sure it was  meant to work that  way, it looked like  the code
meant to send all  the deliveries in one connection, which  is why it didn't
say helo in the second batch.
So, I've removed  the part that closes the connection  after the first chunk
is out.

Barry, was this right?
(I didn't check if it breaks the threaded code path)

Marc

PS: Don't make fun of  me for sticking a '1' in there,  I don't really claim
to  know  python, and  the  parser  was getting  upset  if  I commented  out
conn.quit, or that plus the finally:
I was watching  Buffy on my tivo  before all this happened, and  I'd like to
see the end of the episode :-)
(see, just Like Niguel, I have a worthy excuse :-D)
-- 
Microsoft is to operating systems & security ....
                                      .... what McDonalds is to gourmet cooking
  
Home page: http://marc.merlins.org/   |   Finger marc_f@merlins.org for PGP key