1package Net::DNS::Check::Test::soa_expire_range;
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
23
24sub test() {
25	my ($self) = shift;
26
27	return unless ( $self->{config} );
28
29	my $soa_min_expire = $self->{config}->soa_min_expire();
30	my $soa_max_expire = $self->{config}->soa_max_expire();
31
32	my $test_status = 1;
33	my $test_detail = {};
34
35    foreach my $nsquery ( @{$self->{nsquery}} ) {
36        my $soa_expire = scalar $nsquery->soa_expire();
37		my $ns_name	= $nsquery->ns_name();
38
39		if ($soa_min_expire > 0 && $soa_expire < $soa_min_expire ) {
40			$test_status = 0;
41			$test_detail->{$ns_name}->{status} 	= 0;
42		} elsif ($soa_max_expire > 0 && $soa_expire > $soa_max_expire ) {
43			$test_status = 0;
44			$test_detail->{$ns_name}->{status} 	= 0;
45		} else {
46			$test_detail->{$ns_name}->{status} 	= 1;
47		}
48		$test_detail->{$ns_name}->{desc} 	= "$soa_expire";
49	}
50
51	$self->{test_status} = $test_status;
52	$self->{test_detail} = $test_detail;
53
54	return $test_status;
55}
56
571;
58
59__END__
60
61
62=head1 NAME
63
64Net::DNS::Check::Test::soa_expire_range - Check if the expire time in the SOA RR is within the range set in the configuration object
65
66=head1 SYNOPSIS
67
68C<use Net::DNS::Check::Test::soa_expire_range>;
69
70=head1 DESCRIPTION
71
72Check if the expire time in the SOA RR is within the range set in the configuration object.
73
74=head1 METHODS
75
76=head1 COPYRIGHT
77
78Copyright (c) 2005 Lorenzo Luconi Trombacchi  - IIT-CNR
79
80All rights reserved.  This program is free software; you may redistribute
81it and/or modify it under the same terms as Perl itself.
82
83=head1 SEE ALSO
84
85L<perl(1)>
86
87=cut
88
89