[New-bugs-announce] [issue3802] smtpd.py __getaddr insufficient handling

Marcus CM report at bugs.python.org
Mon Sep 8 06:59:58 CEST 2008


New submission from Marcus CM <marcus at internetnowasp.net>:

The __getaddr does not handle certain valid MAIL FROM well :

For eg,

<marcus at 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 at ap.com.my> SIZE=6092 AUTH=<>
            elif address[0] == '<' and address[-1] == '>' and address !
= '<>':
                # Addresses can be in the form <person at dom.com> but 
watch out
                # for null address, e.g. <>
                                
                if address.count("<") == 1 :
                    address = address[1:-1]
                    
        return address

----------
messages: 72763
nosy: marcus at internetnowasp.net
severity: normal
status: open
title: smtpd.py __getaddr insufficient handling
versions: Python 2.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3802>
_______________________________________


More information about the New-bugs-announce mailing list