From 0b3447338cb0a9161befdbfb0c5819700b169330230761e7a4b6cbd91fe33a21 Mon Sep 17 00:00:00 2001 From: OBS User autobuild Date: Fri, 15 Oct 2010 10:38:41 +0000 Subject: [PATCH] Accepting request 50464 from devel:languages:python:Factory Copy from devel:languages:python:Factory/python based on submit request 50464 from user coolo OBS-URL: https://build.opensuse.org/request/show/50464 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python?expand=0&rev=54 --- python-base.changes | 7 +++++++ python-base.spec | 6 ++++-- python-doc.spec | 2 +- python.spec | 2 +- smtpd-dos.patch | 48 +++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 61 insertions(+), 4 deletions(-) create mode 100644 smtpd-dos.patch diff --git a/python-base.changes b/python-base.changes index 3c0bad4..e93ca98 100644 --- a/python-base.changes +++ b/python-base.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Fri Oct 1 13:41:30 UTC 2010 - jmatejek@novell.com + +- moved unittest to python-base (it is a testing framework, not a + testsuite, so it clearly belongs into stdlib) +- fixed smtpd.py DoS (bnc#638233, CVE probably not assigned) + ------------------------------------------------------------------- Tue Sep 21 10:07:43 UTC 2010 - coolo@novell.com diff --git a/python-base.spec b/python-base.spec index cd59479..5fe034b 100644 --- a/python-base.spec +++ b/python-base.spec @@ -30,7 +30,7 @@ Obsoletes: python-64bit # Summary: Python Interpreter base package Version: 2.7 -Release: 2 +Release: 3 %define tarversion %{version} %define tarname Python-%{tarversion} Source0: %{tarname}.tar.bz2 @@ -50,6 +50,7 @@ Patch7: python-2.6.5-distutils_test_path.patch Patch8: sparc_longdouble.patch Patch9: python-2.7-acrequire.patch Patch10: urllib2-AbstractBasicAuthHandler_reset_attr.diff +Patch11: smtpd-dos.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build %define python_version %(echo %{version} | head -c 3) @@ -139,6 +140,7 @@ Authors: %patch8 -p1 %patch9 -p1 %patch10 +%patch11 # some cleanup find . -name .cvsignore -type f -print0 | xargs -0 rm -f @@ -286,7 +288,6 @@ rm -rf $RPM_BUILD_ROOT %{_includedir}/python* %exclude %{_includedir}/python%{python_version}/pyconfig.h %{_libdir}/python%{python_version}/test -%{_libdir}/python%{python_version}/unittest %defattr(755, root, root) %{_bindir}/python-config %{_bindir}/python%{python_version}-config @@ -333,6 +334,7 @@ rm -rf $RPM_BUILD_ROOT %{_libdir}/python%{python_version}/multiprocessing %{_libdir}/python%{python_version}/plat-* %{_libdir}/python%{python_version}/pydoc_data +%{_libdir}/python%{python_version}/unittest %{_libdir}/python%{python_version}/wsgiref %dir %{_libdir}/python%{python_version}/site-packages %{_libdir}/python%{python_version}/site-packages/README diff --git a/python-doc.spec b/python-doc.spec index 6d8bdff..2b2291f 100644 --- a/python-doc.spec +++ b/python-doc.spec @@ -24,7 +24,7 @@ Group: Development/Languages/Python BuildRoot: %{_tmppath}/%{name}-%{version}-build Summary: Additional Package Documentation for Python. Version: 2.7 -Release: 2 +Release: 3 %define pyver 2.7 BuildArch: noarch %define tarname Python-%{pyver} diff --git a/python.spec b/python.spec index e0c4679..7888758 100644 --- a/python.spec +++ b/python.spec @@ -32,7 +32,7 @@ Obsoletes: python-64bit Obsoletes: python-nothreads python21 python-elementtree python-sqlite Summary: Python Interpreter Version: 2.7 -Release: 2 +Release: 3 Requires: python-base = %{version} %define tarversion %{version} %define tarname Python-%{tarversion} diff --git a/smtpd-dos.patch b/smtpd-dos.patch new file mode 100644 index 0000000..e038019 --- /dev/null +++ b/smtpd-dos.patch @@ -0,0 +1,48 @@ +Index: Lib/smtpd.py +=================================================================== +--- Lib/smtpd.py.orig ++++ Lib/smtpd.py +@@ -121,7 +121,16 @@ class SMTPChannel(asynchat.async_chat): + self.__rcpttos = [] + self.__data = '' + self.__fqdn = socket.getfqdn() +- self.__peer = conn.getpeername() ++ try: ++ self.__peer = conn.getpeername() ++ except socket.error as err: ++ # a race condition may occur if the other end is closing ++ # before we can get the peername ++ #self.connected = False ++ self.close() ++ if err.args[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 +300,24 @@ class SMTPServer(asyncore.dispatcher): + localaddr, remoteaddr) + + def handle_accept(self): +- conn, addr = self.accept() ++ try: ++ conn, addr = self.accept() ++ except TypeError: ++ # sometimes accept() might return None ++ return ++ except socket.error as err: ++ # ECONNABORTED might be thrown ++ if err.args[0] != errno.ECONNABORTED: ++ raise ++ return ++ else: ++ # sometimes addr == None instead of (ip, port) ++ if addr == None: ++ return + print >> DEBUGSTREAM, 'Incoming connection from %s' % repr(addr) + channel = SMTPChannel(self, conn, addr) ++ if not channel.connected: ++ return + + # API for "doing something useful with the message" + def process_message(self, peer, mailfrom, rcpttos, data):