Skip to content

Commit

Permalink
Merge pull request #1273 from zonemaster/master
Browse files Browse the repository at this point in the history
Merge master into develop (Engine)
  • Loading branch information
matsduf authored Aug 8, 2023
2 parents 4500774 + 7af3518 commit c5cdf80
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 31 deletions.
10 changes: 10 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
Release history for Zonemaster component Zonemaster-Engine


v4.7.2 2023-08-07 (public fix version)

[Fixes]
- Fixes bug (regression) in test case BASIC01 that made all tests of
zone names that start with the same letters as the whole first label
of the parent zone fail, e.g. "NOrid.NO" and "FRance.FR". The bug
was introduced in version v4.7.1 in release v2023.1.1. (#1270)


v4.7.1 2023-07-24 (public fix version)

[Fixes]
Expand Down
2 changes: 1 addition & 1 deletion lib/Zonemaster/Engine.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package Zonemaster::Engine;

use version; our $VERSION = version->declare("v4.7.1");
use version; our $VERSION = version->declare("v4.7.2");

use 5.014002;

Expand Down
67 changes: 37 additions & 30 deletions lib/Zonemaster/Engine/Test/Basic.pm
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,7 @@ sub basic01 {

my $ns = ns( $ns_labels[0], $ns_labels[1] );
my $zone_name = $all_servers{$ns_string};
my $pass = 0;

if ( _ip_disabled_message( \@results, $ns, $type_soa ) ) {
next;
Expand All @@ -449,50 +450,56 @@ sub basic01 {
}

if ( not $p->is_redirect and not $p->aa ) {
push @{$non_aa_non_delegation{$zone->name->string}}, $ns_string;
push @{ $non_aa_non_delegation{$zone->name->string} }, $ns_string;
}

if ( $p->is_redirect and index( $zone_name, name( lc( ( $p->get_records( 'NS' ) )[0]->owner ) ) ) == -1
and index( $zone->name, name( lc( ( $p->get_records( 'NS' ) )[0]->owner ) ) ) == -1 ) {
next;
}
if ( $p->is_redirect ) {
my $rr_owner = name( lc( ( $p->get_records( 'NS' ) )[0]->owner ) );
my $rr_owner_labels_count = scalar @{ $rr_owner->labels };
my $zone_labels_count = scalar @{ $zone->name->labels };
my $common_labels_count = $zone->name->common( $rr_owner );

if ( $p->is_redirect and index( $zone->name, name( lc( ( $p->get_records( 'NS' ) )[0]->owner ) ) ) > 0 ) {
$rrs_ns{$_->nsdname}{'referral'} = $_->owner for $p->get_records( 'NS' );
$rrs_ns{$_->owner}{'addresses'}{$_->address} = 1 for ( $p->get_records( q{A} ), $p->get_records( 'AAAA' ) );
unless ( $zone_name->is_in_bailiwick( $rr_owner ) and $rr_owner_labels_count <= $common_labels_count
and $common_labels_count <= $zone_labels_count ) {
next;
}

foreach my $ns_name ( keys %rrs_ns ) {
unless ( exists $rrs_ns{$ns_name}{'addresses'} and scalar keys %{ $rrs_ns{$ns_name}{'addresses'} } > 0 ) {
my $p_a = Zonemaster::Engine::Recursor->recurse( $ns_name, q{A} );
if ( $rr_owner_labels_count <= $common_labels_count and $common_labels_count < $zone_labels_count ) {
$rrs_ns{$_->nsdname}{'referral'} = $_->owner for $p->get_records( 'NS' );
$rrs_ns{$_->owner}{'addresses'}{$_->address} = 1 for ( $p->get_records( q{A} ), $p->get_records( 'AAAA' ) );

if ( $p_a and $p_a->rcode eq 'NOERROR' ) {
$rrs_ns{$ns_name}{'addresses'}{$_->address} = 1 for $p->get_records_for_name( 'A', $ns_name );
}
foreach my $ns_name ( keys %rrs_ns ) {
unless ( exists $rrs_ns{$ns_name}{'addresses'} and scalar keys %{ $rrs_ns{$ns_name}{'addresses'} } > 0 ) {
my $p_a = Zonemaster::Engine::Recursor->recurse( $ns_name, q{A} );

if ( $p_a and $p_a->rcode eq 'NOERROR' ) {
$rrs_ns{$ns_name}{'addresses'}{$_->address} = 1 for $p->get_records_for_name( 'A', $ns_name );
}

my $p_aaaa = Zonemaster::Engine::Recursor->recurse( $ns_name, q{AAAA} );
my $p_aaaa = Zonemaster::Engine::Recursor->recurse( $ns_name, q{AAAA} );

if ( $p_aaaa and $p_aaaa->rcode eq 'NOERROR' ) {
$rrs_ns{$ns_name}{'addresses'}{$_->address} = 1 for $p->get_records_for_name( 'AAAA', $ns_name );
if ( $p_aaaa and $p_aaaa->rcode eq 'NOERROR' ) {
$rrs_ns{$ns_name}{'addresses'}{$_->address} = 1 for $p->get_records_for_name( 'AAAA', $ns_name );
}
}
}

foreach my $ns_ip ( keys %{ $rrs_ns{$ns_name}{'addresses'} } ) {
unless ( grep { $_ eq $ns_ip } @handled_servers ) {
$all_servers{$ns_name . '/' . $ns_ip} = name( $rrs_ns{$ns_name}{'referral'} );
push @remaining_servers, $ns_name . '/' . $ns_ip;
push @handled_servers, $ns_ip;
foreach my $ns_ip ( keys %{ $rrs_ns{$ns_name}{'addresses'} } ) {
unless ( grep { $_ eq $ns_ip } @handled_servers ) {
$all_servers{$ns_name . '/' . $ns_ip} = name( $rrs_ns{$ns_name}{'referral'} );
push @remaining_servers, $ns_name . '/' . $ns_ip;
push @handled_servers, $ns_ip;
}
}
}
}
}

my $pass = 0;
if ( $p->is_redirect and scalar $p->get_records_for_name( 'NS', $zone->name->string ) ) {
$pass += 1;
}
if ( scalar $p->get_records_for_name( 'NS', $zone->name->string ) ) {
$pass += 1;
}

if ( $p->is_redirect and scalar $p->get_records_for_name( 'CNAME', $zone->name->string, q{answer} ) ) {
$pass += 1;
if ( scalar $p->get_records_for_name( 'CNAME', $zone->name->string, q{answer} ) ) {
$pass += 1;
}
}

if ( $p->aa ) {
Expand Down

0 comments on commit c5cdf80

Please sign in to comment.