SHA256
1
0
forked from pool/python

- 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)

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:Factory/python?expand=0&rev=85
This commit is contained in:
Jan Matejek 2010-10-04 13:38:36 +00:00 committed by Git OBS Bridge
parent f1a853c81b
commit 988592dbda
7 changed files with 92 additions and 13 deletions

View File

@ -1,4 +1,4 @@
python
requires "python-base-<targettype> = <version>"
python-base
libpython2_6-1_0
libpython2_7-1_0

View File

@ -1,3 +1,15 @@
-------------------------------------------------------------------
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
- fix baselibs.conf
-------------------------------------------------------------------
Thu Aug 26 15:13:49 UTC 2010 - suse-tux@gmx.de

View File

@ -1,5 +1,5 @@
#
# spec file for package python-base (Version 2.7)
# spec file for package python-base (Version 2.6.5)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@ -18,7 +18,7 @@
Name: python-base
BuildRequires: fdupes pkg-config zlib-devel
BuildRequires: zlib-devel fdupes pkg-config
Url: http://www.python.org/
License: MIT License (or similar)
Group: Development/Languages/Python
@ -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
@ -160,6 +162,11 @@ autoreconf -f -i . # Modules/_ctypes/libffi
# prevent make from trying to rebuild asdl stuff, which requires existing
# python installation
touch Parser/asdl* Python/Python-ast.c Include/Python-ast.h
# use just gcc instead of [GCC 4.5.0 20100604 [gcc-4_5-branch revision 160292]..
echo '#define COMPILER "[GCC]"' >> pyconfig.h.in
# use a compilation date equivalent to the source tarball.
printf '#define DATE "%s %s %s"\n' $(date -u -r %{SOURCE0} +"%b %d %Y") >> pyconfig.h.in
printf '#define TIME "%s"\n' $(date -u -r %{SOURCE0} +"%T") >> pyconfig.h.in
########################################
# configure
########################################
@ -281,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
@ -328,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

View File

@ -1,5 +1,5 @@
#
# spec file for package python-doc (Version 2.7)
# spec file for package python-doc (Version 2.6)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@ -24,7 +24,7 @@ Group: Development/Languages/Python
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Summary: Additional Package Documentation for Python.
Version: 2.7
Release: 1
Release: 23
%define pyver 2.7
BuildArch: noarch
%define tarname Python-%{pyver}

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Tue Aug 31 02:51:56 UTC 2010 - cristian.rodriguez@opensuse.org
- Provide "fake" build enviroment information
* build date replaced by source tarball modify date
* compiler string replaced by "GCC"
* This is intended to avoid republishing the packages
over and over again.
-------------------------------------------------------------------
Thu Aug 26 11:42:44 UTC 2010 - jmatejek@novell.com

View File

@ -1,5 +1,5 @@
#
# spec file for package python (Version 2.7)
# spec file for package python (Version 2.6.5)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@ -18,7 +18,7 @@
Name: python
BuildRequires: db-devel fdupes gdbm-devel gmp-devel libbz2-devel libopenssl-devel ncurses-devel readline-devel sqlite-devel tk-devel xorg-x11-devel
BuildRequires: db-devel gdbm-devel gmp-devel libbz2-devel libopenssl-devel ncurses-devel readline-devel sqlite-devel tk-devel xorg-x11-devel fdupes
#Requires: openssl >= 0.9.8e
Url: http://www.python.org/
License: MIT License (or similar)
@ -32,7 +32,7 @@ Obsoletes: python-64bit
Obsoletes: python-nothreads python21 python-elementtree python-sqlite
Summary: Python Interpreter
Version: 2.7
Release: 1
Release: 2
Requires: python-base = %{version}
%define tarversion %{version}
%define tarname Python-%{tarversion}
@ -202,6 +202,11 @@ autoreconf -f -i . # Modules/_ctypes/libffi
# prevent make from trying to rebuild asdl stuff, which requires existing
# python installation
touch Parser/asdl* Python/Python-ast.c Include/Python-ast.h
# use just gcc instead of [GCC 4.5.0 20100604 [gcc-4_5-branch revision 160292]..
echo '#define COMPILER "[GCC]"' >> pyconfig.h.in
# use a compilation date equivalent to the source tarball.
printf '#define DATE "%s %s %s"\n' $(date -u -r %{SOURCE0} +"%b %d %Y") >> pyconfig.h.in
printf '#define TIME "%s"\n' $(date -u -r %{SOURCE0} +"%T") >> pyconfig.h.in
########################################
# configure
########################################
@ -380,11 +385,9 @@ install -m 644 %{S:3} %{S:4} $RPM_BUILD_ROOT/etc/profile.d
%clean
rm -rf $RPM_BUILD_ROOT
%post
%{run_ldconfig}
%post -p /sbin/ldconfig
%postun
%{run_ldconfig}
%postun -p /sbin/ldconfig
%files idle
%defattr(644, root, root, 755)

48
smtpd-dos.patch Normal file
View File

@ -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):