]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
backport half of 1.11:
authorAnthony Baxter <anthonybaxter@gmail.com>
Wed, 5 Dec 2001 06:11:26 +0000 (06:11 +0000)
committerAnthony Baxter <anthonybaxter@gmail.com>
Wed, 5 Dec 2001 06:11:26 +0000 (06:11 +0000)
__getaddr(): Watch out for empty addresses that can happen when
something like "MAIL FROM:<CR>" is received.  This avoids the
IndexError and rightly returns an SMTP syntax error.

Lib/smtpd.py

index fffc2295194ef6bb0636b3d5627d33520fb05644..95bacaec4ee91adfb1de9137f308c53452f8b53a 100755 (executable)
@@ -206,7 +206,9 @@ class SMTPChannel(asynchat.async_chat):
         keylen = len(keyword)
         if arg[:keylen].upper() == keyword:
             address = arg[keylen:].strip()
-            if address[0] == '<' and address[-1] == '>' and address != '<>':
+            if not address:
+                pass
+            elif address[0] == '<' and address[-1] == '>' and address != '<>':
                 # Addresses can be in the form <person@dom.com> but watch out
                 # for null address, e.g. <>
                 address = address[1:-1]