diff -Nru libnet-dns-resolver-unbound-perl-1.20/Changes libnet-dns-resolver-unbound-perl-1.21/Changes --- libnet-dns-resolver-unbound-perl-1.20/Changes 2022-11-01 19:49:49.000000000 +0000 +++ libnet-dns-resolver-unbound-perl-1.21/Changes 2023-06-09 17:11:02.000000000 +0000 @@ -1,6 +1,10 @@ Revision history for Perl extension Net::DNS::Resolver::Unbound. +**** 1.21 Jun 9, 2023 + Emulate Net::DNS::Resolver send($packet). + + **** 1.20 Nov 1, 2022 Include -I flags from Config{cppflags}. Make feature detection work for XS package. diff -Nru libnet-dns-resolver-unbound-perl-1.20/debian/changelog libnet-dns-resolver-unbound-perl-1.21/debian/changelog --- libnet-dns-resolver-unbound-perl-1.20/debian/changelog 2022-11-26 15:50:03.000000000 +0000 +++ libnet-dns-resolver-unbound-perl-1.21/debian/changelog 2023-06-21 19:14:51.000000000 +0000 @@ -1,3 +1,13 @@ +libnet-dns-resolver-unbound-perl (1.21-1) unstable; urgency=medium + + * Team upload. + * Import upstream version 1.21. + * d/copyright: bump copyright year. + * Declare compliance with Debian Policy 4.6.2. + * no_network_tests.patch: unfuzz. + + -- Étienne Mollier Wed, 21 Jun 2023 21:14:51 +0200 + libnet-dns-resolver-unbound-perl (1.20-1) unstable; urgency=low * Initial release. (Closes: #1024771) diff -Nru libnet-dns-resolver-unbound-perl-1.20/debian/control libnet-dns-resolver-unbound-perl-1.21/debian/control --- libnet-dns-resolver-unbound-perl-1.20/debian/control 2022-11-26 15:50:03.000000000 +0000 +++ libnet-dns-resolver-unbound-perl-1.21/debian/control 2023-06-21 19:14:51.000000000 +0000 @@ -11,7 +11,7 @@ perl-xs-dev, perl:native, pkg-config -Standards-Version: 4.6.1 +Standards-Version: 4.6.2 Vcs-Browser: https://salsa.debian.org/perl-team/modules/packages/libnet-dns-resolver-unbound-perl Vcs-Git: https://salsa.debian.org/perl-team/modules/packages/libnet-dns-resolver-unbound-perl.git Homepage: https://metacpan.org/release/Net-DNS-Resolver-Unbound diff -Nru libnet-dns-resolver-unbound-perl-1.20/debian/copyright libnet-dns-resolver-unbound-perl-1.21/debian/copyright --- libnet-dns-resolver-unbound-perl-1.20/debian/copyright 2022-11-26 15:50:03.000000000 +0000 +++ libnet-dns-resolver-unbound-perl-1.21/debian/copyright 2023-06-21 19:14:51.000000000 +0000 @@ -4,11 +4,12 @@ Upstream-Name: Net-DNS-Resolver-Unbound Files: * -Copyright: 2022, Dick Franks +Copyright: 2022-2023, Dick Franks License: MIT-variant Files: debian/* -Copyright: 2022, gregor herrmann +Copyright: 2022, gregor herrmann , + 2023, Étienne Mollier License: Artistic or GPL-1+ License: Artistic diff -Nru libnet-dns-resolver-unbound-perl-1.20/debian/patches/no_network_tests.patch libnet-dns-resolver-unbound-perl-1.21/debian/patches/no_network_tests.patch --- libnet-dns-resolver-unbound-perl-1.20/debian/patches/no_network_tests.patch 2022-11-26 15:50:03.000000000 +0000 +++ libnet-dns-resolver-unbound-perl-1.21/debian/patches/no_network_tests.patch 2023-06-21 19:14:51.000000000 +0000 @@ -4,18 +4,18 @@ Author: gregor herrmann Last-Update: 2022-11-26 ---- a/t/20-synchronous.t -+++ b/t/20-synchronous.t +--- libnet-dns-resolver-unbound-perl.orig/t/20-synchronous.t ++++ libnet-dns-resolver-unbound-perl/t/20-synchronous.t @@ -13,6 +13,7 @@ debug_level => 0 ); +plan skip_all => 'network tests disabled via NO_NETWORK' if $ENV{NO_NETWORK}; plan skip_all => 'no local nameserver' unless $resolver->nameservers; - plan tests => 4; + plan tests => 5; ---- a/t/25-decode.t -+++ b/t/25-decode.t +--- libnet-dns-resolver-unbound-perl.orig/t/25-decode.t ++++ libnet-dns-resolver-unbound-perl/t/25-decode.t @@ -10,6 +10,7 @@ my $resolver = Net::DNS::Resolver::Unbound->new(); @@ -24,13 +24,13 @@ plan skip_all => 'no local nameserver' unless $resolver->nameservers; plan tests => 4; ---- a/t/30-asynchronous.t -+++ b/t/30-asynchronous.t +--- libnet-dns-resolver-unbound-perl.orig/t/30-asynchronous.t ++++ libnet-dns-resolver-unbound-perl/t/30-asynchronous.t @@ -9,6 +9,7 @@ my $resolver = Net::DNS::Resolver::Unbound->new( debug_level => 0 ); +plan skip_all => 'network tests disabled via NO_NETWORK' if $ENV{NO_NETWORK}; plan skip_all => 'no local nameserver' unless $resolver->nameservers; - plan tests => 5; + plan tests => 7; diff -Nru libnet-dns-resolver-unbound-perl-1.20/lib/Net/DNS/Resolver/Unbound.pm libnet-dns-resolver-unbound-perl-1.21/lib/Net/DNS/Resolver/Unbound.pm --- libnet-dns-resolver-unbound-perl-1.20/lib/Net/DNS/Resolver/Unbound.pm 2022-11-01 19:49:10.000000000 +0000 +++ libnet-dns-resolver-unbound-perl-1.21/lib/Net/DNS/Resolver/Unbound.pm 2023-06-09 17:10:50.000000000 +0000 @@ -8,7 +8,7 @@ our $VERSION; BEGIN { - $VERSION = '1.20'; + $VERSION = '1.21'; eval { __PACKAGE__->bootstrap($VERSION) }; } @@ -77,11 +77,11 @@ =cut sub new { - my $class = shift; - my $self = $class->SUPER::new(); + my ( $class, @argument ) = @_; + my $self = $class->SUPER::new(); $self->{ub_ctx} = Net::DNS::Resolver::Unbound::Context->new(); - while ( my $attr = shift ) { - my $value = shift; + while ( my $attr = shift @argument ) { + my $value = shift @argument; $self->$attr( ref($value) ? @$value : $value ); } return $self; @@ -124,24 +124,34 @@ =cut sub send { - my $self = shift; + my ( $self, @argument ) = @_; $self->_finalise_config; $self->_reset_errorstring; - my $query = $self->_make_query_packet(@_); - my ($q) = $query->question; - my $reply = $self->{ub_ctx}->ub_resolve( $q->name, $q->{qtype}, $q->{qclass} ); - return $self->_decode_result($reply); + my ($packet) = @argument; + my $query = $self->_make_query_packet(@argument); + my $result; + if ( UB_SEND && ref($packet) ) { + $result = $self->{ub_ctx}->ub_send( $query->encode ); + } else { + my ($q) = $query->question; + $result = $self->{ub_ctx}->ub_resolve( $q->name, $q->{qtype}, $q->{qclass} ); + } + + my $reply = $self->_decode_result($result); + $query->header->id( $reply->header->id ); + return $reply; } sub bgsend { - my $self = shift; + my ( $self, @argument ) = @_; $self->_finalise_config; $self->_reset_errorstring; - my $query = $self->_make_query_packet(@_); - my ($q) = $query->question; - return $self->{ub_ctx}->ub_resolve_async( $q->name, $q->{qtype}, $q->{qclass} ); + my $query = $self->_make_query_packet(@argument); + my $ident = $query->header->id; + my ($q) = $query->question; + return $self->{ub_ctx}->ub_resolve_async( $q->name, $q->{qtype}, $q->{qclass}, $ident ); } sub bgbusy { @@ -159,9 +169,10 @@ $self->{ub_ctx}->ub_wait if &bgbusy; - my $query_id = $handle->query_id; $self->errorstring( $handle->err ); - return $self->_decode_result( $handle->result ); + my $reply = $self->_decode_result( $handle->result ) || return; + $reply->header->id( $handle->query_id ); + return $reply; } @@ -289,8 +300,8 @@ =cut sub add_ta { - my $self = shift; - return $self->{ub_ctx}->add_ta( Net::DNS::RR->new(@_)->plain ); + my ( $self, @argument ) = @_; + return $self->{ub_ctx}->add_ta( Net::DNS::RR->new(@argument)->plain ); } @@ -396,10 +407,6 @@ =cut -sub print { - return print shift->string; -} - sub string { my $self = shift; $self = $self->_defaults unless ref($self); @@ -429,7 +436,7 @@ $self->errorstring( $result->why_bogus ) if $result->bogus; my $buffer = $result->answer_packet || return; - my $packet = Net::DNS::Packet->decode(\$buffer); + my $packet = Net::DNS::Packet->decode( \$buffer ); $self->errorstring($@); $packet->print if $self->debug; @@ -466,7 +473,7 @@ =head1 COPYRIGHT -Copyright (c)2022 Dick Franks +Copyright (c)2022,2023 Dick Franks All Rights Reserved diff -Nru libnet-dns-resolver-unbound-perl-1.20/Makefile.PL libnet-dns-resolver-unbound-perl-1.21/Makefile.PL --- libnet-dns-resolver-unbound-perl-1.20/Makefile.PL 2022-10-31 14:03:46.000000000 +0000 +++ libnet-dns-resolver-unbound-perl-1.21/Makefile.PL 2023-05-19 19:06:58.000000000 +0000 @@ -65,7 +65,7 @@ $inc = $ENV{UNBOUND_INCLUDE} if $ENV{UNBOUND_INCLUDE}; $lib = $ENV{UNBOUND_LIB} if $ENV{UNBOUND_LIB}; -chomp $_ foreach ( $inc, $lib ); +chomp $_ for ( $inc, $lib ); my @header = qw(unbound.h); # library headers @@ -96,12 +96,16 @@ package MY; ## customise generated Makefile -sub test { - return shift->SUPER::test() if $^O =~ /cygwin|MSWin/i; - - return join '', shift->SUPER::test(), <<'END'; -# suppress parallel test execution -FULLPERLRUN = HARNESS_OPTIONS=j1:c $(FULLPERL) +sub constants { + return join "\n", shift->SUPER::constants(), <<'END' if $^O =~ /MSWin/i; +# include test directory +TEST_DIR = t +FULLPERLRUN = $(FULLPERL) "-I$(TEST_DIR)" +END + return join "\n", shift->SUPER::constants(), <<'END'; +# suppress parallel test execution include test directory +TEST_DIR = t +FULLPERLRUN = HARNESS_OPTIONS=j1:c $(FULLPERL) "-I$(TEST_DIR)" END } @@ -117,7 +121,7 @@ } eval "require $distro"; ## no critic - my @version = grep {$_} 'version', eval { $distro->VERSION }; + my @version = ( 'version', eval { $distro->VERSION } ); my $nameregex = join '\W+', '', split /::/, "$distro.pm\$"; my @installed = grep { $_ && m/$nameregex/io } values %INC; @@ -163,24 +167,23 @@ sub postamble { - my $devnull = $^O eq 'MSWin32' ? 'nul' : '/dev/null'; - return <<"PlanB" unless `gcov -v 2>$devnull`; -test_cover : - cover -delete - HARNESS_PERL_SWITCHES=-MDevel::Cover \$(MAKE) test - cover -summary -PlanB my $ldflags = "-fprofile-arcs -ftest-coverage"; my $ccflags = "-O0 $ldflags"; - return <<"PlanA"; + my $devnull = $^O eq 'MSWin32' ? 'nul' : '/dev/null'; + return <<"PlanA" if `gcov -v 2>$devnull`; test_cover : cover -delete HARNESS_PERL_SWITCHES=-MDevel::Cover \$(MAKE) -W Unbound.xs test CCFLAGS="$ccflags" OTHERLDFLAGS="$ldflags" - gcov Unbound.xs - gcov2perl Unbound.xs.gcov - cover -summary + cover \$(NOECHO) \$(TOUCH) Unbound.c # force XS rebuild before install PlanA + + return <<'PlanB'; +test_cover : + cover -delete + HARNESS_PERL_SWITCHES=-MDevel::Cover $(MAKE) test + cover +PlanB } diff -Nru libnet-dns-resolver-unbound-perl-1.20/META.json libnet-dns-resolver-unbound-perl-1.21/META.json --- libnet-dns-resolver-unbound-perl-1.20/META.json 2022-11-01 19:50:43.000000000 +0000 +++ libnet-dns-resolver-unbound-perl-1.21/META.json 2023-06-09 17:14:19.000000000 +0000 @@ -4,7 +4,7 @@ "Dick Franks" ], "dynamic_config" : 1, - "generated_by" : "ExtUtils::MakeMaker version 7.64, CPAN::Meta::Converter version 2.150010", + "generated_by" : "ExtUtils::MakeMaker version 7.70, CPAN::Meta::Converter version 2.150010", "license" : [ "mit" ], @@ -49,6 +49,6 @@ } }, "release_status" : "stable", - "version" : "1.20", + "version" : "1.21", "x_serialization_backend" : "JSON::PP version 2.27200" } diff -Nru libnet-dns-resolver-unbound-perl-1.20/META.yml libnet-dns-resolver-unbound-perl-1.21/META.yml --- libnet-dns-resolver-unbound-perl-1.20/META.yml 2022-11-01 19:50:43.000000000 +0000 +++ libnet-dns-resolver-unbound-perl-1.21/META.yml 2023-06-09 17:14:19.000000000 +0000 @@ -11,7 +11,7 @@ configure_requires: ExtUtils::MakeMaker: '6.48' dynamic_config: 1 -generated_by: 'ExtUtils::MakeMaker version 7.64, CPAN::Meta::Converter version 2.150010' +generated_by: 'ExtUtils::MakeMaker version 7.70, CPAN::Meta::Converter version 2.150010' license: mit meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html @@ -26,5 +26,5 @@ DynaLoader: '1.09' Net::DNS: '1.19' perl: '5.008009' -version: '1.20' +version: '1.21' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' diff -Nru libnet-dns-resolver-unbound-perl-1.20/t/10-context.t libnet-dns-resolver-unbound-perl-1.21/t/10-context.t --- libnet-dns-resolver-unbound-perl-1.20/t/10-context.t 2022-10-28 15:09:06.000000000 +0000 +++ libnet-dns-resolver-unbound-perl-1.21/t/10-context.t 2023-06-09 16:12:38.000000000 +0000 @@ -13,8 +13,8 @@ ok( Net::DNS::Resolver::Unbound->string(), 'default configuration' ); my $resolver = Net::DNS::Resolver::Unbound->new(); -ok( $resolver, 'create stub resolver instance' ); -ok( $resolver->print(), '$resolver->print' ); +ok( $resolver, 'create stub resolver instance' ); +ok( $resolver->string(), '$resolver->string' ); my $recursive = Net::DNS::Resolver::Unbound->new( nameservers => [] ); diff -Nru libnet-dns-resolver-unbound-perl-1.20/t/20-synchronous.t libnet-dns-resolver-unbound-perl-1.21/t/20-synchronous.t --- libnet-dns-resolver-unbound-perl-1.20/t/20-synchronous.t 2022-10-31 14:15:46.000000000 +0000 +++ libnet-dns-resolver-unbound-perl-1.21/t/20-synchronous.t 2023-06-09 16:13:30.000000000 +0000 @@ -14,9 +14,9 @@ ); plan skip_all => 'no local nameserver' unless $resolver->nameservers; -plan tests => 4; +plan tests => 5; -my ( $name, $domain ) = qw(ns net-dns.org); +my ( $name, $domain ) = qw(www net-dns.org); ok( $resolver->send("$name.$domain"), "resolver->send('$name.$domain')" ); @@ -29,8 +29,10 @@ ok( $resolver->search($name), "resolver->search('$name')" ); -my $packet = Net::DNS::Packet->new("$name.$domain"); -ok( $resolver->send($packet), 'resolver->search( $packet )' ); +my $packet = $resolver->_make_query_packet("$name.$domain"); +my $reply = $resolver->send($packet); +ok( $reply, 'resolver->send( $packet )' ); +is( $reply->header->id, $packet->header->id, 'reply header ID matches query' ); exit; diff -Nru libnet-dns-resolver-unbound-perl-1.20/t/25-decode.t libnet-dns-resolver-unbound-perl-1.21/t/25-decode.t --- libnet-dns-resolver-unbound-perl-1.20/t/25-decode.t 2022-11-01 19:46:55.000000000 +0000 +++ libnet-dns-resolver-unbound-perl-1.21/t/25-decode.t 2023-06-09 17:07:23.000000000 +0000 @@ -14,7 +14,7 @@ plan tests => 4; -my $qname = 'ns.net-dns.org'; +my $qname = 'www.net-dns.org'; my $ub_ctx = $resolver->{ub_ctx}; my $secure = $ub_ctx->mock_resolve( $qname, 1, 0 ); diff -Nru libnet-dns-resolver-unbound-perl-1.20/t/30-asynchronous.t libnet-dns-resolver-unbound-perl-1.21/t/30-asynchronous.t --- libnet-dns-resolver-unbound-perl-1.20/t/30-asynchronous.t 2022-11-01 19:47:23.000000000 +0000 +++ libnet-dns-resolver-unbound-perl-1.21/t/30-asynchronous.t 2023-06-09 16:22:31.000000000 +0000 @@ -10,26 +10,26 @@ my $resolver = Net::DNS::Resolver::Unbound->new( debug_level => 0 ); plan skip_all => 'no local nameserver' unless $resolver->nameservers; -plan tests => 5; +plan tests => 7; -my $fqdn = 'ns.net-dns.org.'; +my $fqdn = 'www.net-dns.org.'; for ( my $handle = $resolver->bgsend($fqdn) ) { ok( $handle, "resolver->bgsend('$fqdn')" ); - - sleep 1 if $resolver->bgbusy($handle); - - ok( !$handle->err, 'handle->err empty' ); - ok( $resolver->bgread($handle), 'reselver->bgread(handle)' ); + my $reply = $resolver->bgread($handle); + ok( $reply, 'resolver->bgread(handle)' ); + ok( !$handle->err, 'handle->err empty' ); } -my $packet = Net::DNS::Packet->new($fqdn); +my $packet = $resolver->_make_query_packet($fqdn); for ( my $handle = $resolver->bgsend($packet) ) { - my $reply = $resolver->bgread($handle); ok( $handle, "resolver->bgsend(packet)" ); - ok( $reply, 'reselver->bgread(handle)' ); + my $reply = $resolver->bgread($handle); + ok( $reply, 'resolver->bgread(handle)' ); + ok( !$handle->err, 'handle->err empty' ); + is( $reply->header->id, $packet->header->id, 'reply ID matches query packet' ); } diff -Nru libnet-dns-resolver-unbound-perl-1.20/t/35-bgread.t libnet-dns-resolver-unbound-perl-1.21/t/35-bgread.t --- libnet-dns-resolver-unbound-perl-1.20/t/35-bgread.t 2022-11-01 19:46:29.000000000 +0000 +++ libnet-dns-resolver-unbound-perl-1.21/t/35-bgread.t 2023-06-09 16:23:03.000000000 +0000 @@ -7,7 +7,7 @@ use Net::DNS::Resolver::Unbound; -plan tests => 14; +plan tests => 12; my $resolver = Net::DNS::Resolver::Unbound->new(); @@ -24,8 +24,7 @@ ok( $handle->waiting(), 'handle->waiting' ); ok( $resolver->bgbusy($handle), 'bgbusy' ); ok( !$handle->err(), 'no handle->err' ); - is( $handle->query_id(), $id, 'handle->query_id' ); - is( $handle->result(), undef, 'no handle->result' ); + ok( !$handle->result(), 'no handle->result' ); } @@ -33,10 +32,10 @@ ok( !$handle->waiting(), 'not handle->waiting' ); ok( !$resolver->bgbusy($handle), 'not bgbusy' ); ok( $handle->err(), 'handle->err' ); - is( $handle->query_id(), $id, 'handle->query_id' ); - is( $handle->result(), undef, 'no handle->result' ); + ok( !$handle->result(), 'no handle->result' ); is( $resolver->bgread($handle), undef, 'undefined bgread' ); - like( $resolver->errorstring(), "/$err/", 'unknown error' ); + my $errorstring = $resolver->errorstring; + like( $errorstring, "/$err/", "errorstring: [$errorstring]" ); } diff -Nru libnet-dns-resolver-unbound-perl-1.20/Unbound.xs libnet-dns-resolver-unbound-perl-1.21/Unbound.xs --- libnet-dns-resolver-unbound-perl-1.20/Unbound.xs 2022-11-01 16:24:43.000000000 +0000 +++ libnet-dns-resolver-unbound-perl-1.21/Unbound.xs 2023-06-09 16:11:55.000000000 +0000 @@ -1,11 +1,11 @@ =head1 NAME -Unbound.xs - Perl interface to libunbound +Unbound.xs - Perl binding for NLnetLabs libunbound =head1 DESCRIPTION -Perl XS extension providing access to the NLnetLabs libunbound library. +Perl XS extension providing access to the libunbound resolver library. This implementation is intended to support Net::DNS::Resolver::Unbound. It is NOT, nor will it ever be, suitable for general use. @@ -13,7 +13,7 @@ =head1 COPYRIGHT -Copyright (c)2022 Dick Franks +Copyright (c)2022-2023 Dick Franks All Rights Reserved @@ -94,8 +94,9 @@ query_id(struct av* handle) INIT: SV** index = av_fetch(handle, 0, 0); + int id = SvIVX(*index); CODE: - RETVAL = SvIVX(*index); + RETVAL = id; OUTPUT: RETVAL @@ -114,7 +115,7 @@ INIT: SV** index = av_fetch(handle, 2, 0); CODE: - RETVAL = index ? av_pop(handle) : NULL; + RETVAL = index ? av_pop(handle) : newSVpv("", 0); OUTPUT: RETVAL @@ -257,10 +258,12 @@ Net::DNS::Resolver::Unbound::Handle ub_resolve_async(struct ub_ctx* ctx, SV* name, int rrtype, int rrclass, int query_id=0) + INIT: + int async_id = 0; CODE: RETVAL = newAV(); checkerr( ub_resolve_async(ctx, (const char*) SvPVX(name), rrtype, rrclass, - (void*) RETVAL, async_callback, NULL) ); + (void*) RETVAL, async_callback, &async_id) ); av_push(RETVAL, newSViv(query_id) ); OUTPUT: RETVAL @@ -320,19 +323,19 @@ RETVAL Net::DNS::Resolver::Unbound::Handle -emulate_callback(int query_id, int err, struct ub_result* result=NULL) +emulate_callback(int async_id, int err, struct ub_result* result=NULL) CODE: RETVAL = newAV(); - av_push(RETVAL, newSViv(query_id) ); + av_push(RETVAL, newSViv(async_id) ); async_callback( (void*) RETVAL, err, result ); OUTPUT: RETVAL Net::DNS::Resolver::Unbound::Handle -emulate_wait(int query_id) +emulate_wait(int async_id) CODE: RETVAL = newAV(); - av_push(RETVAL, newSViv(query_id) ); + av_push(RETVAL, newSViv(async_id) ); OUTPUT: RETVAL