Compare commits

...

No commits in common. 'c9' and 'c8-stream-5.30' have entirely different histories.

2
.gitignore vendored

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

@ -1 +1 @@
f03c8f9701a95dc55561db27b4ae9e60ecb56b65 SOURCES/Socket-2.031.tar.gz 52b077e0502519aae775113c5a1a1ddf94c8e2d8 SOURCES/Socket-2.029.tar.gz

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

@ -1,12 +1,13 @@
Name: perl-Socket Name: perl-Socket
Epoch: 4 Epoch: 4
Version: 2.031 Version: 2.029
Release: 4%{?dist} Release: 4%{?dist}
Summary: Networking constants and support functions Summary: Networking constants and support functions
License: GPL+ or Artistic License: GPL+ or Artistic
URL: https://metacpan.org/release/Socket URL: https://metacpan.org/release/Socket
Source0: https://cpan.metacpan.org/authors/id/P/PE/PEVANS/Socket-%{version}.tar.gz Source0: https://cpan.metacpan.org/authors/id/P/PE/PEVANS/Socket-%{version}.tar.gz
BuildRequires: coreutils # 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: findutils
BuildRequires: gcc BuildRequires: gcc
BuildRequires: make BuildRequires: make
@ -21,7 +22,6 @@ BuildRequires: perl(ExtUtils::MakeMaker) >= 6.76
BuildRequires: perl(strict) BuildRequires: perl(strict)
BuildRequires: perl(warnings) BuildRequires: perl(warnings)
# Run-time: # Run-time:
BuildRequires: perl(:VERSION) >= 5.6.1
BuildRequires: perl(Carp) BuildRequires: perl(Carp)
BuildRequires: perl(Exporter) BuildRequires: perl(Exporter)
# Scalar::Util is needed only if getaddrinfo(3) does not exist. Not our case. # Scalar::Util is needed only if getaddrinfo(3) does not exist. Not our case.
@ -31,7 +31,6 @@ BuildRequires: perl(XSLoader)
BuildRequires: perl(Errno) BuildRequires: perl(Errno)
BuildRequires: perl(Test::More) BuildRequires: perl(Test::More)
Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version)) Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version))
Requires: perl(:VERSION) >= 5.6.1
%{?perl_default_filter} %{?perl_default_filter}
@ -45,6 +44,7 @@ human-readable and native binary forms, and for hostname resolver operations.
%prep %prep
%setup -q -n Socket-%{version} %setup -q -n Socket-%{version}
%patch0 -p1
%build %build
perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1 OPTIMIZE="$RPM_OPT_FLAGS" perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1 OPTIMIZE="$RPM_OPT_FLAGS"
@ -66,31 +66,6 @@ make test
%{_mandir}/man3/* %{_mandir}/man3/*
%changelog %changelog
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 4:2.031-4
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 4:2.031-3
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 4:2.031-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Wed Jan 06 2021 Jitka Plesnikova <jplesnik@redhat.com> - 4:2.031-1
- 2.031 bump
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 4:2.030-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Tue Jul 07 2020 Petr Pisar <ppisar@redhat.com> - 4:2.030-1
- 2.030 bump
* Mon Jun 22 2020 Jitka Plesnikova <jplesnik@redhat.com> - 4:2.029-456
- Increase release to favour standalone package
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 4:2.029-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 4:2.029-4 * Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 4:2.029-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild

Loading…
Cancel
Save