Compare commits

..

No commits in common. "c8-stream-5.26" and "c8-stream-5.3" have entirely different histories.

4 changed files with 103 additions and 13 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
SOURCES/Socket-2.027.tar.gz
SOURCES/Socket-2.029.tar.gz

View File

@ -1 +1 @@
3b63fd457ce6034066d56ae32962c168918df83d SOURCES/Socket-2.027.tar.gz
52b077e0502519aae775113c5a1a1ddf94c8e2d8 SOURCES/Socket-2.029.tar.gz

View File

@ -0,0 +1,66 @@
From 0be99f8799e90eaed4e8eeb7d5be7de81dd71360 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
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.
<https://rt.perl.org/Public/Bug/Display.html?id=97860>
<https://bugzilla.redhat.com/show_bug.cgi?id=1693293>
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
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

View File

@ -1,22 +1,24 @@
Name: perl-Socket
Epoch: 4
Version: 2.027
Release: 2%{?dist}
Version: 2.029
Release: 4%{?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
URL: https://metacpan.org/release/Socket
Source0: https://cpan.metacpan.org/authors/id/P/PE/PEVANS/Socket-%{version}.tar.gz
# Make Socket::inet_aton() thread safe, CPAN RT#129189, bug #1693293
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-interpreter
BuildRequires: perl(Config)
BuildRequires: perl(ExtUtils::CBuilder)
BuildRequires: perl(ExtUtils::Constant) >= 0.23
# ExtUtils::Constant::ProxySubs not used
BuildRequires: perl(ExtUtils::MakeMaker)
BuildRequires: perl(ExtUtils::MakeMaker) >= 6.76
BuildRequires: perl(strict)
BuildRequires: perl(warnings)
# Run-time:
@ -33,8 +35,8 @@ 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
This Perl 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
@ -42,13 +44,14 @@ 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}
perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1 OPTIMIZE="$RPM_OPT_FLAGS"
%{make_build}
%install
make pure_install DESTDIR=$RPM_BUILD_ROOT
%{make_install}
find $RPM_BUILD_ROOT -type f -name '*.bs' -size 0 -delete
%{_fixperms} $RPM_BUILD_ROOT/*
@ -63,6 +66,27 @@ make test
%{_mandir}/man3/*
%changelog
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 4:2.029-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Thu May 30 2019 Jitka Plesnikova <jplesnik@redhat.com> - 4:2.029-3
- Perl 5.30 rebuild
* Mon Apr 15 2019 Petr Pisar <ppisar@redhat.com> - 4:2.029-2
- Make Socket::inet_aton() thread safe (bug #1693293)
* Fri Feb 22 2019 Petr Pisar <ppisar@redhat.com> - 4:2.029-1
- 2.029 bump
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 4:2.027-418
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 4:2.027-417
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Wed Jun 27 2018 Jitka Plesnikova <jplesnik@redhat.com> - 4:2.027-416
- Increase release to favour standalone package
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 4:2.027-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild