diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5c42ad0 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/Socket-2.027.tar.gz diff --git a/.perl-Socket.metadata b/.perl-Socket.metadata new file mode 100644 index 0000000..0a105f6 --- /dev/null +++ b/.perl-Socket.metadata @@ -0,0 +1 @@ +3b63fd457ce6034066d56ae32962c168918df83d SOURCES/Socket-2.027.tar.gz diff --git a/SOURCES/Socket-2.029-inet_aton-Use-getaddrinfo-if-possible.patch b/SOURCES/Socket-2.029-inet_aton-Use-getaddrinfo-if-possible.patch new file mode 100644 index 0000000..124152b --- /dev/null +++ b/SOURCES/Socket-2.029-inet_aton-Use-getaddrinfo-if-possible.patch @@ -0,0 +1,66 @@ +From 0be99f8799e90eaed4e8eeb7d5be7de81dd71360 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= +Date: Thu, 11 Apr 2019 18:17:16 +0200 +Subject: [PATCH] inet_aton: Use getaddrinfo() if possible +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Socket::inet_aton() used gethostbyname() to process arguments that are +not an IP addres. However, gethostbyname() is not thread-safe and when +called from multiple threads a bogus value can be returned. + +This patch does add any new test because a basic inet_aton() usage is +already covered and because reproducing the thread failure would +require flodding DNS servers with thousounds of request. + + + + +Signed-off-by: Petr Písař +--- + Socket.xs | 16 +++++++++++++++- + 1 file changed, 15 insertions(+), 1 deletion(-) + +diff --git a/Socket.xs b/Socket.xs +index e46c93e..65244dd 100644 +--- a/Socket.xs ++++ b/Socket.xs +@@ -764,19 +764,33 @@ inet_aton(host) + char * host + CODE: + { ++#ifdef HAS_GETADDRINFO ++ struct addrinfo *res; ++ struct addrinfo hints = {0,}; ++ hints.ai_family = AF_INET; ++ if (!getaddrinfo(host, NULL, &hints, &res)) { ++ ST(0) = sv_2mortal(newSVpvn( ++ (char *)&(((struct sockaddr_in *)res->ai_addr)->sin_addr.s_addr), ++ 4 ++ )); ++ freeaddrinfo(res); ++ XSRETURN(1); ++ } ++#else + struct in_addr ip_address; + struct hostent * phe; +- + if ((*host != '\0') && inet_aton(host, &ip_address)) { + ST(0) = sv_2mortal(newSVpvn((char *)&ip_address, sizeof(ip_address))); + XSRETURN(1); + } + #ifdef HAS_GETHOSTBYNAME ++ /* gethostbyname is not thread-safe */ + phe = gethostbyname(host); + if (phe && phe->h_addrtype == AF_INET && phe->h_length == 4) { + ST(0) = sv_2mortal(newSVpvn((char *)phe->h_addr, phe->h_length)); + XSRETURN(1); + } ++#endif + #endif + XSRETURN_UNDEF; + } +-- +2.20.1 + diff --git a/SPECS/perl-Socket.spec b/SPECS/perl-Socket.spec new file mode 100644 index 0000000..276e6c3 --- /dev/null +++ b/SPECS/perl-Socket.spec @@ -0,0 +1,253 @@ +Name: perl-Socket +Epoch: 4 +Version: 2.027 +Release: 3%{?dist} +Summary: Networking constants and support functions +License: GPL+ or Artistic +URL: http://search.cpan.org/dist/Socket/ +Source0: http://search.cpan.org/CPAN/authors/id/P/PE/PEVANS/Socket-%{version}.tar.gz +# Make Socket::inet_aton() thread safe, CPAN RT#129189, bug #1699793 +Patch0: Socket-2.029-inet_aton-Use-getaddrinfo-if-possible.patch +BuildRequires: findutils +BuildRequires: gcc +BuildRequires: make +BuildRequires: perl-interpreter +BuildRequires: perl-devel +BuildRequires: perl-generators +BuildRequires: perl(Config) +BuildRequires: perl(ExtUtils::CBuilder) +BuildRequires: perl(ExtUtils::Constant) >= 0.23 +# ExtUtils::Constant::ProxySubs not used +BuildRequires: perl(ExtUtils::MakeMaker) +BuildRequires: perl(strict) +BuildRequires: perl(warnings) +# Run-time: +BuildRequires: perl(Carp) +BuildRequires: perl(Exporter) +# Scalar::Util is needed only if getaddrinfo(3) does not exist. Not our case. +BuildRequires: perl(warnings::register) +BuildRequires: perl(XSLoader) +# Tests only: +BuildRequires: perl(Errno) +BuildRequires: perl(Test::More) +Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version)) + +%{?perl_default_filter} + +%description +This module provides a variety of constants, structure manipulators and other +functions related to socket-based networking. The values and functions +provided are useful when used in conjunction with Perl core functions such as +socket(), setsockopt() and bind(). It also provides several other support +functions, mostly for dealing with conversions of network addresses between +human-readable and native binary forms, and for hostname resolver operations. + +%prep +%setup -q -n Socket-%{version} +%patch0 -p1 + +%build +perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 OPTIMIZE="$RPM_OPT_FLAGS" +make %{?_smp_mflags} + +%install +make pure_install DESTDIR=$RPM_BUILD_ROOT +find $RPM_BUILD_ROOT -type f -name '*.bs' -size 0 -delete +%{_fixperms} $RPM_BUILD_ROOT/* + +%check +make test + +%files +%license Artistic Copying LICENSE +%doc Changes +%{perl_vendorarch}/auto/* +%{perl_vendorarch}/Socket* +%{_mandir}/man3/* + +%changelog +* Mon Apr 15 2019 Petr Pisar - 4:2.027-3 +- Make Socket::inet_aton() thread safe (bug #1699793) + +* Fri Feb 09 2018 Fedora Release Engineering - 4:2.027-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Mon Jan 15 2018 Petr Pisar - 4:2.027-1 +- 2.027 bump + +* Fri Jan 12 2018 Petr Pisar - 4:2.026-1 +- 2.026 bump + +* Fri Jan 12 2018 Petr Pisar - 4:2.025-2 +- Fix compiler warnings (CPAN RT#124044) + +* Wed Jan 10 2018 Petr Pisar - 4:2.025-1 +- 2.025 bump + +* Thu Aug 03 2017 Fedora Release Engineering - 4:2.024-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild + +* Thu Jul 27 2017 Fedora Release Engineering - 4:2.024-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Sat Jun 03 2017 Jitka Plesnikova - 4:2.024-3 +- Perl 5.26 rebuild + +* Sat Feb 11 2017 Fedora Release Engineering - 4:2.024-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Fri Aug 12 2016 Jitka Plesnikova - 4:2.024-1 +- 2.024 bump + +* Thu Aug 04 2016 Jitka Plesnikova - 4:2.023-1 +- 2.023 bump + +* Tue Aug 02 2016 Jitka Plesnikova - 4:2.022-1 +- 2.022 bump + +* Sat May 14 2016 Jitka Plesnikova - 4:2.021-3 +- Increase epoch to favour standalone package + +* Thu Feb 04 2016 Fedora Release Engineering - 3:2.021-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Thu Nov 19 2015 Petr Pisar - 3:2.021-1 +- 2.021 bump + +* Thu Jun 25 2015 Petr Pisar - 3:2.020-1 +- 2.020 bump + +* Thu Jun 18 2015 Fedora Release Engineering - 3:2.019-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Wed Jun 03 2015 Jitka Plesnikova - 2:2.019-2 +- Perl 5.22 rebuild +- Increase Epoch to favour standalone package + +* Thu Apr 30 2015 Petr Pisar - 2:2.019-1 +- 2.019 bump + +* Fri Feb 13 2015 Petr Pisar - 2:2.018-1 +- 2.018 bump + +* Wed Feb 11 2015 Petr Pisar - 2:2.017-1 +- 2.017 bump + +* Thu Oct 09 2014 Petr Pisar - 2:2.016-1 +- 2.016 bump + +* Wed Sep 03 2014 Jitka Plesnikova - 2:2.015-3 +- Increase Epoch to favour standalone package + +* Tue Aug 26 2014 Jitka Plesnikova - 1:2.015-2 +- Perl 5.20 rebuild + +* Mon Aug 18 2014 Petr Pisar - 1:2.015-1 +- 0.15 bump + +* Sun Aug 17 2014 Fedora Release Engineering - 1:2.014-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild + +* Sat Jun 07 2014 Fedora Release Engineering - 1:2.014-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Mon Jun 02 2014 Petr Pisar - 1:2.014-1 +- 2.014 bump + +* Tue Oct 29 2013 Petr Pisar - 1:2.013-1 +- 2.013 bump + +* Tue Sep 10 2013 Petr Pisar - 1:2.012-1 +- 2.012 bump + +* Tue Aug 06 2013 Petr Pisar - 1:2.011-1 +- 2.011 bump + +* Sun Aug 04 2013 Fedora Release Engineering - 1:2.010-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild + +* Fri Jul 12 2013 Petr Pisar - 1:2.010-3 +- Link minimal build-root packages against libperl.so explicitly + +* Fri Jul 12 2013 Petr Pisar - 1:2.010-2 +- Perl 5.18 rebuild + +* Fri Jul 12 2013 Petr Pisar - 1:2.010-1 +- Increase epoch to compete with perl.spec + +* Tue Jun 25 2013 Petr Pisar - 2.010-1 +- 2.010 bump + +* Fri May 24 2013 Petr Pisar - 2.009-3 +- Specify all dependencies + +* Thu Feb 14 2013 Fedora Release Engineering - 2.009-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Mon Jan 21 2013 Petr Pisar - 2.009-1 +- 2.009 bump + +* Thu Jan 03 2013 Petr Pisar - 2.008-1 +- 2.008 bump + +* Mon Dec 17 2012 Petr Pisar - 2.007-1 +- 2.007 bump + +* Thu Nov 08 2012 Petr Pisar - 2.006-2 +- Update description + +* Mon Aug 20 2012 Petr Pisar - 2.006-1 +- 2.006 bump + +* Fri Aug 17 2012 Petr Pisar - 2.005-1 +- 2.005 bump + +* Thu Aug 16 2012 Petr Pisar - 2.004-1 +- 2.004 bump + +* Fri Jul 20 2012 Fedora Release Engineering - 2.002-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Wed Jun 13 2012 Petr Pisar - 2.002-2 +- Perl 5.16 rebuild + +* Mon Jun 11 2012 Petr Pisar - 2.002-1 +- 2.002 bump + +* Wed Jun 06 2012 Petr Pisar - 2.001-2 +- Perl 5.16 rebuild + +* Wed Mar 28 2012 Petr Pisar - 2.001-1 +- 2.001 bump (bug-fixing release) + +* Tue Mar 27 2012 Petr Pisar - 2.000-3 +- Fix invalid write while unpacking AF_UNIX sockaddr (bug #806543) + +* Mon Mar 19 2012 Petr Pisar - 2.000-2 +- Increase release number due to F17 build + +* Wed Mar 14 2012 Petr Pisar - 2.000-1 +- 2.000 bump +- Fix a buffer overflow (RT#75623) + +* Wed Feb 22 2012 Petr Pisar - 1.99-1 +- 1.99 bump + +* Thu Feb 16 2012 Petr Pisar - 1.98-1 +- 1.98 bump + +* Fri Jan 13 2012 Fedora Release Engineering - 1.97-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Mon Dec 19 2011 Petr Pisar - 1.97-1 +- 1.97 bump +- License texts added + +* Mon Dec 12 2011 Petr Pisar - 1.96-1 +- 1.96 bump + +* Fri Dec 02 2011 Petr Pisar - 1.95-1 +- 1.95 bump + +* Wed Nov 23 2011 Petr Pisar 1.94.07-1 +- 1.94_07 packaged.