Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix code in Basic01 #1249

Merged
merged 1 commit into from
Jul 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/Zonemaster/Engine/Test.pm
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ sub run_all_for {
push @results, Zonemaster::Engine::Test::Basic->all( $zone );
info( MODULE_END => { module => 'Zonemaster::Engine::Test::Basic' } );

if ( Zonemaster::Engine::Test::Basic->can_continue( @results ) and Zonemaster::Engine->can_continue() ) {
if ( Zonemaster::Engine::Test::Basic->can_continue( $zone, @results ) and Zonemaster::Engine->can_continue() ) {
foreach my $mod ( __PACKAGE__->modules ) {

my $module = "Zonemaster::Engine::Test::$mod";
Expand Down
18 changes: 11 additions & 7 deletions lib/Zonemaster/Engine/Test/Basic.pm
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ sub all {
{
push @results, $class->basic01( $zone );

push @results, $class->basic02( $zone );
if ( grep { $_->tag eq q{B01_CHILD_FOUND} } @results ) {
push @results, $class->basic02( $zone );
}

# Perform BASIC3 if BASIC2 failed
if ( none { $_->tag eq q{B02_AUTH_RESPONSE_SOA} } @results ) {
Expand All @@ -61,14 +63,15 @@ sub all {
} ## end sub all

sub can_continue {
my ( $class, @results ) = @_;
my ( $class, $zone, @results ) = @_;
my %tag = map { $_->tag => 1 } @results;
my $is_undelegated = Zonemaster::Engine::Recursor->has_fake_addresses( $zone->name->string );

if ( not $tag{B02_NO_DELEGATION} and $tag{B02_AUTH_RESPONSE_SOA} ) {
return 1;
}
else {
return;
return $is_undelegated;
}
}

Expand Down Expand Up @@ -450,11 +453,11 @@ sub basic01 {
}

if ( $p->is_redirect and index( $zone_name, name( lc( ( $p->get_records( 'NS' ) )[0]->owner ) ) ) == -1
and index( $zone->name->fqdn, 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 and index( $zone->name->fqdn, name( lc( ( $p->get_records( 'NS' ) )[0]->owner ) ) ) > 0 ) {
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' ) );

Expand All @@ -475,7 +478,7 @@ sub basic01 {

foreach my $ns_ip ( keys %{ $rrs_ns{$ns_name}{'addresses'} } ) {
unless ( grep { $_ eq $ns_ip } @handled_servers ) {
$all_servers{$ns_name . '/' . $ns_ip} = $rrs_ns{$ns_name}{'referral'};
$all_servers{$ns_name . '/' . $ns_ip} = name( $rrs_ns{$ns_name}{'referral'} );
push @remaining_servers, $ns_name . '/' . $ns_ip;
push @handled_servers, $ns_ip;
}
Expand Down Expand Up @@ -584,8 +587,9 @@ sub basic01 {

if ( $p->aa and scalar $p->get_records_for_name( 'SOA', $zone->name->string, q{answer} ) ) {
if ( $zone->name->next_higher eq $zone_name ) {
push @{ $aa_soa{$zone_name} }, $ns_string;
push @{ $parent_found{$zone_name} }, $ns_string;
}
push @{ $aa_soa{$zone_name} }, $ns_string;
}

if ( $p->aa and scalar $p->get_records_for_name( 'CNAME', $zone->name->string, q{answer} ) ) {
Expand Down
Loading