Add fix for SA41968 (CVE-2010-3493) from the 2.7 branch repo

http://svn.python.org/view/python/branches/release27-maint/Lib/smtpd.py?r1=86084
&r2=82503&view=patch
This commit is contained in:
tez 2010-11-17 18:44:06 +00:00
parent f2eea9d0ac
commit 96a928f480
3 changed files with 43 additions and 3 deletions

View file

@ -1,9 +1,9 @@
# $NetBSD: Makefile,v 1.29 2010/09/17 07:11:42 obache Exp $
# $NetBSD: Makefile,v 1.30 2010/11/17 18:44:06 tez Exp $
.include "dist.mk"
PKGNAME= python26-${PY_DISTVERSION}
PKGREVISION= 2
PKGREVISION= 3
CATEGORIES= lang python
MAINTAINER= pkgsrc-users@NetBSD.org

View file

@ -1,4 +1,4 @@
$NetBSD: distinfo,v 1.27 2010/09/22 09:13:47 obache Exp $
$NetBSD: distinfo,v 1.28 2010/11/17 18:44:06 tez Exp $
SHA1 (Python-2.6.6.tar.bz2) = a1daf2c2c7cffe0939c015260447572fe75c7e50
RMD160 (Python-2.6.6.tar.bz2) = 2d63f4f0ad3c124a8e62215ca94bd0231350e912
@ -16,3 +16,4 @@ SHA1 (patch-ao) = 8c6a156b0f0c2a6d319658477fff348e6a0c3603
SHA1 (patch-ap) = d23a869a449ab9dc166cfa149913b20c9acad9cb
SHA1 (patch-au) = 38030fc45afc2a8f53a41f26b649e731642b9148
SHA1 (patch-av) = d6bf0419015656a8d2f13d3132873e453c8a6b6e
SHA1 (patch-aw) = e74bae33eb95c821b5147f5c89c3ee7cb061db95

View file

@ -0,0 +1,39 @@
$NetBSD: patch-aw,v 1.1 2010/11/17 18:44:07 tez Exp $
Fix for SA41968 (CVE-2010-3493) from the 2.7 branch repo
http://svn.python.org/view/python/branches/release27-maint/Lib/smtpd.py?r1=86084&r2=82503&view=patch
--- Lib/smtpd2.6.py.orig 2010-06-30 12:41:25.000000000 -0500
+++ Lib/smtpd2.6.py 2010-11-17 12:19:14.825489100 -0600
@@ -121,7 +121,15 @@
self.__rcpttos = []
self.__data = ''
self.__fqdn = socket.getfqdn()
- self.__peer = conn.getpeername()
+ try:
+ self.__peer = conn.getpeername()
+ except socket.error, err:
+ # a race condition may occur if the other end is closing
+ # before we can get the peername
+ self.close()
+ if err[0] != errno.ENOTCONN:
+ raise
+ return
print >> DEBUGSTREAM, 'Peer:', repr(self.__peer)
self.push('220 %s %s' % (self.__fqdn, __version__))
self.set_terminator('\r\n')
@@ -291,9 +299,11 @@
localaddr, remoteaddr)
def handle_accept(self):
- conn, addr = self.accept()
- print >> DEBUGSTREAM, 'Incoming connection from %s' % repr(addr)
- channel = SMTPChannel(self, conn, addr)
+ pair = self.accept()
+ if pair is not None:
+ conn, addr = pair
+ print >> DEBUGSTREAM, 'Incoming connection from %s' % repr(addr)
+ channel = SMTPChannel(self, conn, addr)
# API for "doing something useful with the message"
def process_message(self, peer, mailfrom, rcpttos, data):