Merged update from upstream sources
This is an automated DistroBaker update from upstream sources. If you do not know what this is about or would like to opt out, contact the OSCI team. Source: https://src.fedoraproject.org/rpms/perl-Socket.git#a4d9a135c914637f113c7d984637b5c6e1d22310
This commit is contained in:
parent
2d8d1aeab4
commit
027f29af1d
1
.gitignore
vendored
1
.gitignore
vendored
@ -33,3 +33,4 @@
|
||||
/Socket-2.027.tar.gz
|
||||
/Socket-2.029.tar.gz
|
||||
/Socket-2.030.tar.gz
|
||||
/Socket-2.031.tar.gz
|
||||
|
||||
@ -1,66 +0,0 @@
|
||||
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,13 +1,11 @@
|
||||
Name: perl-Socket
|
||||
Epoch: 4
|
||||
Version: 2.030
|
||||
Release: 2%{?dist}
|
||||
Version: 2.031
|
||||
Release: 1%{?dist}
|
||||
Summary: Networking constants and support functions
|
||||
License: GPL+ or Artistic
|
||||
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: coreutils
|
||||
BuildRequires: findutils
|
||||
BuildRequires: gcc
|
||||
@ -47,7 +45,6 @@ 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 NO_PERLLOCAL=1 OPTIMIZE="$RPM_OPT_FLAGS"
|
||||
@ -69,6 +66,9 @@ make test
|
||||
%{_mandir}/man3/*
|
||||
|
||||
%changelog
|
||||
* 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
|
||||
|
||||
|
||||
2
sources
2
sources
@ -1 +1 @@
|
||||
SHA512 (Socket-2.030.tar.gz) = 76d520e8cd60ac5f4d5e713eec784d4b626593c2b24f91dc07bb3df1eab844c1124cff8797bcad6144b32bd6bd2b2eca2f3244784f4fb33ddc15c18ba9ae442e
|
||||
SHA512 (Socket-2.031.tar.gz) = 8c44f20be19988a26ea2c451ec0e5a732d5471ea5cc1af93a1c1c202fb283ee6ccc094c940b9e258d7613ef8afcbfa52581ccdb65feb1008cead46fa7f036924
|
||||
|
||||
Loading…
Reference in New Issue
Block a user