This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: smtpd.py __getaddr insufficient handling
Type: behavior Stage: resolved
Components: Versions: Python 3.2, Python 3.3, Python 2.7
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: barry, lpolzer, marcus@internetnowasp.net, petri.lehtinen
Priority: normal Keywords: patch

Created on 2008-09-08 04:59 by marcus@internetnowasp.net, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (4)
msg72763 - (view) Author: Marcus CM (marcus@internetnowasp.net) Date: 2008-09-08 04:59
The __getaddr does not handle certain valid MAIL FROM well :

For eg,

<marcus@internetnow.com.my> SIZE=7777 AUTH=<>

would result in a mismatch of bracket handling.


Suggested fix is :-

def __getaddr(self, keyword, arg):
        address = None
        keylen = len(keyword)
        if arg[:keylen].upper() == keyword:
            address = arg[keylen:].strip()
            if not address:
                pass
            
            # Marcus fix :
            i  = address.count("<")
            ii = address.count(">")            
            if i != ii :
                address = None
                return address
            
            # Marcus remark : bug if : <abc@ap.com.my> SIZE=6092 AUTH=<>
            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. <>
                                
                if address.count("<") == 1 :
                    address = address[1:-1]
                    
        return address
msg109304 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2010-07-05 06:13
Note there is a patch inline, not sure if a doc patch is needed for this.
msg146013 - (view) Author: Petri Lehtinen (petri.lehtinen) * (Python committer) Date: 2011-10-20 09:41
AFAIK, the extra MAIL FROM and RCPT TO parameters are only valid for ESMTP. smtpd doesn't currently handle ESMTP, so this should not be a problem.
msg309756 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2018-01-10 00:56
I'm closing this as won't fix since smtpd.py is deprecated and will likely not get any future development.  Please see aiosmtpd as a much better third party replacement.
History
Date User Action Args
2022-04-11 14:56:38adminsetgithub: 48052
2018-01-10 00:56:50barrysetstatus: open -> closed

nosy: + barry
messages: + msg309756

resolution: wont fix
stage: test needed -> resolved
2014-02-03 15:45:59BreamoreBoysetnosy: - BreamoreBoy
2013-11-20 10:54:37lpolzersetnosy: + lpolzer
2011-10-20 09:41:53petri.lehtinensetnosy: + petri.lehtinen

messages: + msg146013
versions: + Python 2.7, Python 3.2, Python 3.3, - Python 2.6
2010-07-05 06:13:21BreamoreBoysetnosy: + BreamoreBoy
messages: + msg109304

keywords: + patch
type: behavior
stage: test needed
2008-09-08 04:59:56marcus@internetnowasp.netcreate