| 1 | package Net::DNS::Check::Test::host_not_cname; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use vars qw(@ISA $VERSION); | ||
| 5 | |||
| 6 | @ISA = qw(Net::DNS::Check::Test); | ||
| 7 | |||
| 8 | |||
| 9 | sub 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 | |||
| 23 | |||
| 24 | |||
| 25 | sub test() { | ||
| 26 | my ($self) = shift; | ||
| 27 | |||
| 28 | my $test_status = 1; | ||
| 29 | my @host_array; | ||
| 30 | my $test_detail = {}; | ||
| 31 | |||
| 32 | |||
| 33 | foreach my $nsquery ( @{$self->{nsquery}} ) { | ||
| 34 | foreach my $host ( $nsquery->hostslist()->get_list() ) { | ||
| 35 | push ( @host_array, $nsquery->hostslist()->get_host($host) ); | ||
| 36 | } | ||
| 37 | } | ||
| 38 | |||
| 39 | foreach my $host ( $self->{hostslist}->get_list() ) { | ||
| 40 | push ( @host_array, $self->{hostslist}->get_host($host) ); | ||
| 41 | } | ||
| 42 | |||
| 43 | |||
| 44 | |||
| 45 | foreach my $host ( @host_array ) { | ||
| 46 | |||
| 47 | my $hostname = $host->get_hostname(); | ||
| 48 | next if ( exists $test_detail->{$hostname} ); | ||
| 49 | |||
| 50 | $test_detail->{$hostname}->{desc} = $hostname; | ||
| 51 | if ( $host->get_cname() ) { | ||
| 52 | $test_detail->{$hostname}->{status} = 0; | ||
| 53 | $test_status = 0; | ||
| 54 | } else { | ||
| 55 | $test_detail->{$hostname}->{status} = 1; | ||
| 56 | } | ||
| 57 | |||
| 58 | } | ||
| 59 | |||
| 60 | $self->{test_status} = $test_status; | ||
| 61 | $self->{test_detail} = $test_detail; | ||
| 62 | |||
| 63 | return $test_status; | ||
| 64 | } | ||
| 65 | |||
| 66 | 1; | ||
| 67 | |||
| 68 | |||
| 69 | __END__ |