mirror of
https://github.com/python/cpython.git
synced 2025-11-27 05:44:16 +00:00
fix issue #9129: added proper error handling when accepting new connections in SMTPServer.handle_accept
This commit is contained in:
parent
6cbe4275cb
commit
5c8c9a2c33
2 changed files with 18 additions and 2 deletions
17
Lib/smtpd.py
17
Lib/smtpd.py
|
|
@ -413,8 +413,21 @@ class SMTPServer(asyncore.dispatcher):
|
||||||
self.__class__.__name__, time.ctime(time.time()),
|
self.__class__.__name__, time.ctime(time.time()),
|
||||||
localaddr, remoteaddr), file=DEBUGSTREAM)
|
localaddr, remoteaddr), file=DEBUGSTREAM)
|
||||||
|
|
||||||
def handle_accept(self):
|
def handle_accept(self)
|
||||||
conn, addr = self.accept()
|
try:
|
||||||
|
conn, addr = self.accept()
|
||||||
|
except TypeError:
|
||||||
|
# sometimes accept() might return None
|
||||||
|
return
|
||||||
|
except socket.error, err:
|
||||||
|
# ECONNABORTED might be thrown
|
||||||
|
if err[0] != errno.ECONNABORTED:
|
||||||
|
raise
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
# sometimes addr == None instead of (ip, port)
|
||||||
|
if addr == None:
|
||||||
|
return
|
||||||
print('Incoming connection from %s' % repr(addr), file=DEBUGSTREAM)
|
print('Incoming connection from %s' % repr(addr), file=DEBUGSTREAM)
|
||||||
channel = self.channel_class(self, conn, addr)
|
channel = self.channel_class(self, conn, addr)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -117,6 +117,9 @@ Extensions
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- Issue #9129: smtpd.py module is vulnerable to DoS attacks due to missing
|
||||||
|
error handling when accepting new connections.
|
||||||
|
|
||||||
- Issue #843590: Make "macintosh" an alias to the "mac_roman" encoding.
|
- Issue #843590: Make "macintosh" an alias to the "mac_roman" encoding.
|
||||||
|
|
||||||
- Create os.fsdecode(): decode from the filesystem encoding with
|
- Create os.fsdecode(): decode from the filesystem encoding with
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue