]> granicus.if.org Git - python/commitdiff
Backport 58594:
authorNeal Norwitz <nnorwitz@gmail.com>
Tue, 23 Oct 2007 05:35:11 +0000 (05:35 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Tue, 23 Oct 2007 05:35:11 +0000 (05:35 +0000)
Issue #1307, patch by Derek Shockey.
When "MAIL" is received without args, an exception happens instead of
sending a 501 syntax error response.

Lib/smtpd.py
Misc/NEWS

index c656ec76396a62fb5df0200eec1104b635ef2c8a..4aa34763ecff0a2fa84af1d3561666ba2939e3ef 100755 (executable)
@@ -221,7 +221,7 @@ class SMTPChannel(asynchat.async_chat):
 
     def smtp_MAIL(self, arg):
         print >> DEBUGSTREAM, '===> MAIL', arg
-        address = self.__getaddr('FROM:', arg)
+        address = self.__getaddr('FROM:', arg) if arg else None
         if not address:
             self.push('501 Syntax: MAIL FROM:<address>')
             return
index a3912191d8806c6da374b05c9779f930ead492dc..4cc936db04d9c6031f4ea57e8a47880af1710233 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -32,6 +32,8 @@ Core and builtins
 Library
 -------
 
+- Bug #1307: Fix smtpd so it doesn't raise an exception when there is no arg.
+
 - ctypes will now work correctly on 32-bit systems when Python is
   configured with --with-system-ffi.