diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/perl-LDAP.spec b/perl-LDAP.spec index 15c7ac1..13e4811 100644 --- a/perl-LDAP.spec +++ b/perl-LDAP.spec @@ -9,7 +9,7 @@ Name: perl-LDAP Version: 0.68 -Release: 2%{?dist} +Release: 3%{?dist} Epoch: 1 Summary: LDAP Perl module License: GPL+ or Artistic @@ -19,6 +19,9 @@ Source0: https://cpan.metacpan.org/authors/id/M/MA/MARSCHAP/perl-ldap-%{v Patch0: perl-ldap-0.65-Configure-usr-sbin-slapd-for-tests.patch # Remove an unreliable cancelling test Patch1: perl-ldap-0.66-test-Remove-a-test-for-cancelling-asynchronous-calls.patch +# Fix resolving localhost on loopback-only machines, +# , CPAN RT#104793 +Patch2: perl-ldap-0.68-Do-not-default-IO-Socket-IP-to-AI_ADDRCONFIG-flag.patch BuildArch: noarch BuildRequires: coreutils BuildRequires: make @@ -164,6 +167,7 @@ Tests from %{name}-%{version}. Execute them with "%{_libexecdir}/%{name}/test". %setup -q -n perl-ldap-%{version} %patch0 -p1 %patch1 -p1 +%patch2 -p1 chmod -c 644 bin/* contrib/* lib/Net/LDAP/DSML.pm perl -pi -e 's|^#!/usr/local/bin/perl\b|#!%{__perl}|' contrib/* # Remove bundled libraries @@ -223,6 +227,10 @@ make test %{_libexecdir}/%{name} %changelog +* Tue Feb 16 2021 Petr Pisar - 1:0.68-3 +- Fix resolving localhost on loopback-only machines + (https://github.com/perl-ldap/perl-ldap/pull/60) + * Wed Jan 27 2021 Fedora Release Engineering - 1:0.68-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild diff --git a/perl-ldap-0.68-Do-not-default-IO-Socket-IP-to-AI_ADDRCONFIG-flag.patch b/perl-ldap-0.68-Do-not-default-IO-Socket-IP-to-AI_ADDRCONFIG-flag.patch new file mode 100644 index 0000000..78bd8e6 --- /dev/null +++ b/perl-ldap-0.68-Do-not-default-IO-Socket-IP-to-AI_ADDRCONFIG-flag.patch @@ -0,0 +1,51 @@ +From 957a39309fa2f8a85a6b8a0a2c5b1751a151cb8b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= +Date: Tue, 16 Feb 2021 15:29:58 +0100 +Subject: [PATCH] Do not default IO::Socket::IP to AI_ADDRCONFIG flag +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +t/40connect.t fails if the only available network interface is +loopback and IO::Socket::IP is installed: + + # perl -Ilib -I. t/40connect.t + 1..3 + ok 1 - client with IPv4/IPv6 auto-selection, bound to ::1 + ldap://localhost:9009/ Name or service not known at t/common.pl line 157. + # Looks like your test exited with 22 just after 1. + +The reason is that IO::Socket::IP by default resolves host names with +AI_ADDRCONFIG flag and in the particular case (no interfaces other +than loopback) a system resolver (glibc in my case) hides both IPv4 +and IPv6 addreses of the hostname (e.g. localhost). + +See for more +details. + +I applied a workaround similar to one found in IO-Socket-SSL. +I believe that other Socket implementations perl-ldap can use do not +suffer from this problem. + +Signed-off-by: Petr Písař +--- + lib/Net/LDAP.pm | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/lib/Net/LDAP.pm b/lib/Net/LDAP.pm +index 5dfe3e3..be11d12 100644 +--- a/lib/Net/LDAP.pm ++++ b/lib/Net/LDAP.pm +@@ -167,6 +167,9 @@ sub connect_ldap { + LocalAddr => $arg->{localaddr} || undef, + Proto => 'tcp', + ($class eq 'IO::Socket::IP' ? 'Family' : 'Domain') => $domain, ++ # Work around IO::Socket::IP defaulting to AI_ADDRCONFIG which breaks ++ # resolution if only a loopback interface is available. CPAN RT#104793. ++ ($class eq 'IO::Socket::IP' and $domain ne AF_UNSPEC ? ('GetAddrInfoFlags' => 0) : ()), + MultiHomed => $arg->{multihomed}, + Timeout => defined $arg->{timeout} + ? $arg->{timeout} +-- +2.26.2 + diff --git a/plans/sanity.fmf b/plans/sanity.fmf new file mode 100644 index 0000000..a72ded4 --- /dev/null +++ b/plans/sanity.fmf @@ -0,0 +1,5 @@ +summary: Sanity tests +discover: + how: fmf +execute: + how: tmt diff --git a/tests/upstream-tests.fmf b/tests/upstream-tests.fmf new file mode 100644 index 0000000..cbecfa9 --- /dev/null +++ b/tests/upstream-tests.fmf @@ -0,0 +1,4 @@ +summary: Upstream tests +component: perl-LDAP +require: perl-LDAP-tests +test: /usr/libexec/perl-LDAP/test