1package Net::DNS::Check::Test::ns_compare;
2
3use strict;
4use vars qw(@ISA $VERSION);
5
6@ISA     = qw(Net::DNS::Check::Test);
7
8
9sub new {
10   	my ($class) 	= shift;
11
12	my ($self) = bless {}, $class;
13
14	if ( @_ ) {
15		$self->_process_args(@_);
16	}
17
18	$self->test();
19
20	return $self;
21}
22
23sub test() {
24    my ($self) = shift;
25
26    # return unless ( $self->{config} );
27
28    my $test_status = 1;
29    my %compare_hash;
30    my $test_detail = {};
31
32    foreach my $nsquery ( @{$self->{nsquery}} ) {
33        my @ns_list = sort $nsquery->ns_list();
34        my $ns_name = $nsquery->ns_name();
35        my $nskey = lc(join('|', @ns_list));
36
37        if ($nskey) {
38            $compare_hash{$nskey}++;
39        }
40
41        $test_detail->{$ns_name}->{desc} = join(' ', @ns_list);
42    }
43
44    if ((scalar keys %compare_hash) > 1) {
45        $test_status = 0;
46    }
47
48    $self->{test_status} = $test_status;
49    $self->{test_detail} = $test_detail;
50
51    return $test_status;
52}
53
541;
55
56__END__
57
58=head1 NAME
59
60Net::DNS::Check::Test::ns_compare - Check if the NS RR are the same in all the authoritative nameservers
61
62=head1 SYNOPSIS
63
64C<use Net::DNS::Check::Test::ns_compare>;
65
66=head1 DESCRIPTION
67
68Check if the NS RR are the same in all the authoritative nameservers
69
70=head1 METHODS
71
72=head1 COPYRIGHT
73
74Copyright (c) 2005 Lorenzo Luconi Trombacchi  - IIT-CNR
75
76All rights reserved.  This program is free software; you may redistribute
77it and/or modify it under the same terms as Perl itself.
78
79=head1 SEE ALSO
80
81L<perl(1)>
82
83=cut
84
85