[Python-checkins] CVS: python/dist/src/Lib smtpd.py,1.10,1.11

Barry Warsaw bwarsaw@users.sourceforge.net
Sat, 03 Nov 2001 19:04:27 -0800


Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv14440

Modified Files:
	smtpd.py 
Log Message:
Two bug fixes for problems reported by Sverre:

__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.

parseargs(): We didn't handle the 2-arg case where both the localspec
and the remotespec were provided on the command line.


Index: smtpd.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/smtpd.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** smtpd.py	2001/10/09 15:46:31	1.10
--- smtpd.py	2001/11/04 03:04:25	1.11
***************
*** 212,216 ****
          if arg[:keylen].upper() == keyword:
              address = arg[keylen:].strip()
!             if address[0] == '<' and address[-1] == '>' and address != '<>':
                  # Addresses can be in the form <person@dom.com> but watch out
                  # for null address, e.g. <>
--- 212,218 ----
          if arg[:keylen].upper() == keyword:
              address = arg[keylen:].strip()
!             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. <>
***************
*** 490,493 ****
--- 492,498 ----
          localspec = args[0]
          remotespec = 'localhost:25'
+     elif len(args) < 3:
+         localspec = args[0]
+         remotespec = args[1]
      else:
          usage(1, 'Invalid arguments: %s' % COMMASPACE.join(args))