[Python-bugs-list] smtplib putcmd space+CRLF bug (PR#69)

jlim@natsoft.com.my jlim@natsoft.com.my
Mon, 30 Aug 1999 04:19:59 -0400 (EDT)


Full_Name: John Lim
Version: 1.5.2
OS: Win95 and WinNT
Submission from: bkj-cache81.jaring.my (161.142.78.81)


This bug was first found by Sonny Soh (sonny@natsoft.com.my).

We think we have found a bug in "smtplib.py". In this library, every SMTP
command has a space and CRLF appended to it. We have connected to the VPOP3 pop
server, and it refuses to accept commands sent from smtplib.py.

The problem appears to be because of the space between the DATA command and the
CRLF.So we did a small modification in smtplib.py, to remove that particular
SPACE.

Old SMTP command in smtplib.py:
DATA \r\n

New SMTP command after patch. This is how Netscape Messager and Outlook Express
sends commands too:
DATA\r\n


vpop3 download page : http://www.pscs.co.uk/software/vpop3.html

Suggested fix is to add the following line:

234a235
>         if str[len(str)-3:] == ' '+ CRLF: str = str[:len(str)-3]+CRLF

In context:
def putcmd(self, cmd, args=""):
    """Send a command to the server."""
    str = '%s %s%s' % (cmd, args, CRLF)
    if str[len(str)-3:] == ' '+ CRLF: str = str[:len(str)-3]+CRLF
    self.send(str)