diff --git a/miniupnpc-cve.patch b/miniupnpc-cve.patch new file mode 100644 index 0000000..50ee596 --- /dev/null +++ b/miniupnpc-cve.patch @@ -0,0 +1,27 @@ +diff -Naur miniupnpc-2.0.old/minixml.c miniupnpc-2.0/minixml.c +--- miniupnpc-2.0.old/minixml.c 2022-01-30 10:21:20.876729280 +0100 ++++ miniupnpc-2.0/minixml.c 2022-01-30 10:22:12.790614016 +0100 +@@ -161,7 +161,8 @@ + if (p->xml >= p->xmlend) + return; + } +- if(memcmp(p->xml, " */ ++ if((p->xmlend >= (p->xml + (9 + 3))) && (memcmp(p->xml, "xml += 9; +diff -Naur miniupnpc-2.0.old/upnpreplyparse.c miniupnpc-2.0/upnpreplyparse.c +--- miniupnpc-2.0.old/upnpreplyparse.c 2022-01-30 10:21:20.877729297 +0100 ++++ miniupnpc-2.0/upnpreplyparse.c 2022-01-30 10:25:48.381585002 +0100 +@@ -104,9 +104,7 @@ + struct NameValueParserData * data) + { + struct xmlparser parser; +- data->l_head = NULL; +- data->portListing = NULL; +- data->portListingLength = 0; ++ memset(data, 0, sizeof(struct NameValueParserData)); + /* init xmlparser object */ + parser.xmlstart = buffer; + parser.xmlsize = bufsize; diff --git a/miniupnpc-tests.patch b/miniupnpc-tests.patch deleted file mode 100644 index a6e2d93..0000000 --- a/miniupnpc-tests.patch +++ /dev/null @@ -1,33 +0,0 @@ -diff -up miniupnpc-1.9/CMakeLists.txt.orig miniupnpc-1.9/CMakeLists.txt ---- miniupnpc-1.9/CMakeLists.txt.orig 2014-04-16 00:13:30.289068350 -0300 -+++ miniupnpc-1.9/CMakeLists.txt 2014-04-16 00:16:15.527074677 -0300 -@@ -128,25 +128,25 @@ if (UPNPC_BUILD_TESTS) - target_link_libraries (testminixml ${LDLIBS}) - - add_executable (minixmlvalid minixmlvalid.c minixml.c) -- target_link_libraries (minixmlvalid ${LDLIBS}) -+ target_link_libraries (minixmlvalid ${LDLIBS} -L. -lminiupnpc) - - add_executable (testupnpreplyparse testupnpreplyparse.c - minixml.c upnpreplyparse.c) -- target_link_libraries (testupnpreplyparse ${LDLIBS}) -+ target_link_libraries (testupnpreplyparse ${LDLIBS} -L. -lminiupnpc) - - add_executable (testigddescparse testigddescparse.c - igd_desc_parse.c minixml.c miniupnpc.c miniwget.c minissdpc.c - upnpcommands.c upnpreplyparse.c minisoap.c connecthostport.c - portlistingparse.c receivedata.c - ) -- target_link_libraries (testigddescparse ${LDLIBS}) -+ target_link_libraries (testigddescparse ${LDLIBS} -L. -lminiupnpc) - - add_executable (testminiwget testminiwget.c - miniwget.c miniupnpc.c minisoap.c upnpcommands.c minissdpc.c - upnpreplyparse.c minixml.c igd_desc_parse.c connecthostport.c - portlistingparse.c receivedata.c - ) -- target_link_libraries (testminiwget ${LDLIBS}) -+ target_link_libraries (testminiwget ${LDLIBS} -L. -lminiupnpc) - - # set (UPNPC_INSTALL_TARGETS ${UPNPC_INSTALL_TARGETS} testminixml minixmlvalid testupnpreplyparse testigddescparse testminiwget) - endif (UPNPC_BUILD_TESTS) diff --git a/miniupnpc-version.patch b/miniupnpc-version.patch deleted file mode 100644 index 11193e9..0000000 --- a/miniupnpc-version.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- CMakeLists.txt.orig 2016-06-08 10:22:31.058083356 +0200 -+++ CMakeLists.txt 2016-06-08 10:22:49.698117692 +0200 -@@ -118,7 +118,6 @@ - if (UPNPC_BUILD_SHARED) - add_library (upnpc-shared SHARED ${MINIUPNPC_SOURCES}) - set_target_properties (upnpc-shared PROPERTIES OUTPUT_NAME "miniupnpc") -- set_target_properties (upnpc-shared PROPERTIES VERSION ${MINIUPNPC_VERSION}) - set_target_properties (upnpc-shared PROPERTIES SOVERSION ${MINIUPNPC_API_VERSION}) - target_link_libraries (upnpc-shared ${LDLIBS}) - set (UPNPC_INSTALL_TARGETS ${UPNPC_INSTALL_TARGETS} upnpc-shared) diff --git a/miniupnpc.spec b/miniupnpc.spec index 766b930..447b8ef 100644 --- a/miniupnpc.spec +++ b/miniupnpc.spec @@ -1,138 +1,95 @@ -%if 0%{?fedora} >= 18 -%global with_python3 1 -%global basepy3dir %(echo ../`basename %{py3dir}`) -%else -%global with_python3 0 -%endif -%global major 16 +%global __python /usr/bin/python2 + %filter_provides_in %{python_sitearch}/.*\.so$ -Summary: Library and tool to control NAT in UPnP-enabled routers -Name: miniupnpc -Version: 2.0 -Release: 1%{?dist} -License: BSD -Group: System Environment/Libraries -URL: http://miniupnp.free.fr/ -Source: http://miniupnp.free.fr/files/%{name}-%{version}.tar.gz -BuildRequires: cmake -BuildRequires: python2-devel -# Do not create libminiupnpc.so.%%{version} and libminiupnpc.so.%%{major} linking to it -Patch0: %{name}-version.patch -# Link to and find libminiupnpc -Patch1: %{name}-tests.patch -Source1: USAGE +Summary: Library and tool to control NAT in UPnP-enabled routers +Name: miniupnpc +Version: 2.0 +Release: 2%{?dist} +License: BSD +URL: http://miniupnp.free.fr/ -%description -miniupnpc is an implementation of a UPnP client library, enabling -applications to access the services provided by an UPnP "Internet -Gateway Device" present on the network. In UPnP terminology, it is -a UPnP Control Point. +Source0: http://miniupnp.free.fr/files/%{name}-%{version}.tar.gz +Source1: USAGE +Patch0: %{name}-cve.patch -This package includes upnpc, a UPnP client application for configuring -port forwarding in UPnP enabled routers. +BuildRequires: cmake3 +BuildRequires: python2-setuptools -%package devel -Summary: Development files for miniupnpc -Group: Development/Libraries -Requires: %{name}%{?_isa} = %{version}-%{release} +%description +miniupnpc is an implementation of a UPnP client library, enabling applications +to access the services provided by an UPnP "Internet Gateway Device" present on +the network. In UPnP terminology, it is a UPnP Control Point. -%description devel -This package contains the header files and development documentation -for %{name}. +This package includes upnpc, a UPnP client application for configuring port +forwarding in UPnP enabled routers. -%package -n python-%{name} -Summary: Python interface to %{name} -Group: System Environment/Libraries -Requires: %{name}%{?_isa} = %{version}-%{release} +%package devel +Summary: Development files for miniupnpc +Requires: %{name}%{?_isa} = %{version}-%{release} -%description -n python-%{name} -This package contains python interfaces to %{name}. +%description devel +This package contains the header files and development documentation for +%{name}. -%if %{with_python3} -%package -n python3-%{name} -Summary: Python3 interface to %{name} -Group: System Environment/Libraries -Requires: %{name}%{?_isa} = %{version}-%{release} -BuildRequires: python3-devel +%package -n python-%{name} +Summary: Python interface to %{name} +Requires: %{name}%{?_isa} = %{version}-%{release} -%description -n python3-%{name} -This package contains python3 interfaces to %{name}. -%endif +%description -n python-%{name} +This package contains python interfaces to %{name}. %prep -%setup -q -%patch0 -p0 -%patch1 -p1 +%autosetup -p1 cp %{SOURCE1} . -sed -i "s|\(\tpython setup.py install\)$|\1 --root=\$(DESTDIR)/|" Makefile -%if %{with_python3} -sed -i "s|\(\tpython3 setup.py install\)$|\1 --root=\$(DESTDIR)/|" Makefile -%endif - -# version not updated in setup.py -sed -i 's/"1\.7"/"%{version}"/' setup.py - -# Changelog says added -ansi without reason, but that -# breaks C files (python module) using C++ comments -sed -i 's/\(CFLAGS += -ansi\)/#\1/' Makefile +sed -i -e 's|setup.py install|setup.py install --root=$(DESTDIR)/|g' Makefile %build mkdir -p build pushd build -%cmake \ - -DUPNPC_BUILD_STATIC=OFF \ - -DUPNPC_BUILD_TESTS=ON \ - .. +%cmake3 \ + -DUPNPC_BUILD_STATIC=OFF \ + -DUPNPC_BUILD_TESTS=ON \ + .. make upnpc-shared all popd make pythonmodule -%if %{with_python3} -make pythonmodule3 -%endif make upnpc-shared %install make install DESTDIR=$RPM_BUILD_ROOT -C build make DESTDIR=$RPM_BUILD_ROOT installpythonmodule -%if %{with_python3} -make DESTDIR=$RPM_BUILD_ROOT installpythonmodule3 -%endif install -D -m644 man3/miniupnpc.3 $RPM_BUILD_ROOT/%{_mandir}/man3/miniupnpc.3 install -D -m 0755 upnpc-shared $RPM_BUILD_ROOT%{_bindir}/upnpc %check make CFLAGS="%{optflags} -DMINIUPNPC_SET_SOCKET_TIMEOUT" check -%post -p /sbin/ldconfig - -%postun -p /sbin/ldconfig +%{?ldconfig_scriptlets} %files -%doc Changelog.txt -%doc LICENSE -%doc README -%{_libdir}/libminiupnpc.so.%{major} +%license LICENSE +%doc Changelog.txt README USAGE +%{_libdir}/libminiupnpc.so.16 +%{_libdir}/libminiupnpc.so.%{version} %{_bindir}/upnpc -%doc USAGE -%files devel +%files devel %{_includedir}/miniupnpc %{_libdir}/libminiupnpc.so %{_mandir}/man3/miniupnpc.3* -%files -n python-%{name} +%files -n python-%{name} %{python_sitearch}/miniupnpc-%{version}-py?.?.egg-info %{python_sitearch}/miniupnpc.so -%if %{with_python3} -%files -n python3-%{name} -%{python3_sitearch}/miniupnpc-%{version}-py?.?.egg-info -%{python3_sitearch}/miniupnpc*.so -%endif - %changelog +* Sun Jan 30 2022 Simone Caronni - 2.0-2 +- Clean up SPEC file. +- Add patch to fix CVE-2017-1000494 (backported from 2.1). +- Drop conditions for Python 3 etc, other branches have moved forward. + * Wed Jun 08 2016 François Kooman - 2.0-1 - update to 2.0