| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Net::DNS::ZoneParse::Parser::Native::DNSext; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# This package contains code only needed to extent Net::DNS::RR. |
|
4
|
|
|
|
|
|
|
# according patches had been sent, but until they are merged, |
|
5
|
|
|
|
|
|
|
# requiring this file provides a suitable workaround. |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
package Net::DNS::RR; |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head3 $fqdn = $self->dns_fqdn($domain, $origin) |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
If $domain isn't fully qualified and thus not ending with a dot, the origin |
|
12
|
|
|
|
|
|
|
will be appended. In both cases the finalizing dot will be cut off afterwards. |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
This functions is inteded to be used by the extension of Net::DNS::RR::xx |
|
15
|
|
|
|
|
|
|
parsing functionality. |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=cut |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub dns_fqdn { |
|
20
|
8
|
|
|
8
|
0
|
15
|
my ($self, $name, $origin) = @_; |
|
21
|
8
|
|
|
|
|
25
|
$name = $self->_dns_expand_chars($name, $origin); |
|
22
|
8
|
50
|
|
|
|
22
|
$name = $origin unless $name; |
|
23
|
8
|
100
|
|
|
|
26
|
$name .= ".".$origin unless(substr($name, -1) eq "."); |
|
24
|
8
|
|
|
|
|
26
|
return substr($name, 0, -1); # last char must be a dot now |
|
25
|
|
|
|
|
|
|
} |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# expand any special character within one item |
|
28
|
|
|
|
|
|
|
# called as |
|
29
|
|
|
|
|
|
|
# $self->_dns_expand_chars($string, $origin) |
|
30
|
|
|
|
|
|
|
sub _dns_expand_chars { |
|
31
|
8
|
|
|
8
|
|
12
|
local($_); |
|
32
|
8
|
|
|
|
|
10
|
$_ = $_[1]; |
|
33
|
8
|
|
100
|
|
|
48
|
my $origin = $_[2] || ""; |
|
34
|
8
|
|
|
|
|
15
|
s/(?
|
|
35
|
8
|
|
|
|
|
12
|
s/\\(\d+)/pack("C",$1)/e; |
|
|
0
|
|
|
|
|
0
|
|
|
36
|
8
|
|
|
|
|
12
|
s/\\//; |
|
37
|
8
|
|
|
|
|
12
|
$_[1] = $_; |
|
38
|
8
|
|
|
|
|
19
|
return $_; |
|
39
|
|
|
|
|
|
|
} |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# extend Net::DNS::RR to make it possible to parse the string differently |
|
42
|
|
|
|
|
|
|
# from files and from packets |
|
43
|
|
|
|
|
|
|
# |
|
44
|
|
|
|
|
|
|
# the default is to reuse the new_from_string |
|
45
|
|
|
|
|
|
|
# |
|
46
|
|
|
|
|
|
|
sub new_from_filestring { |
|
47
|
0
|
|
|
0
|
0
|
|
my ($self, $ele, $data, $param) = @_; |
|
48
|
0
|
|
|
|
|
|
return $self->new_from_string($ele, $self->_dns_expand_chars( |
|
49
|
|
|
|
|
|
|
$data, $param->{origin})); |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
package Net::DNS::RR::CNAME; |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub new_from_filestring { |
|
55
|
0
|
|
|
0
|
0
|
|
my ($self, $ele, $data, $param) = @_; |
|
56
|
0
|
|
|
|
|
|
return $self->new_from_string($ele, |
|
57
|
|
|
|
|
|
|
$self->dns_fqdn($data, $param->{origin})); |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
package Net::DNS::RR::MX; |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub new_from_filestring { |
|
63
|
0
|
|
|
0
|
0
|
|
my ($self, $ele, $data, $param) = @_; |
|
64
|
|
|
|
|
|
|
# as the exchange is the only host and always the last item, |
|
65
|
|
|
|
|
|
|
# it is possible to simply use dns_fqdn here, too |
|
66
|
0
|
|
|
|
|
|
return $self->new_from_string($ele, |
|
67
|
|
|
|
|
|
|
$self->dns_fqdn($data, $param->{origin})); |
|
68
|
|
|
|
|
|
|
} |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
package Net::DNS::RR::NS; |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub new_from_filestring { |
|
73
|
0
|
|
|
0
|
0
|
|
my ($self, $ele, $data, $param) = @_; |
|
74
|
0
|
|
|
|
|
|
return $self->new_from_string($ele, |
|
75
|
|
|
|
|
|
|
$self->dns_fqdn($data, $param->{origin})); |
|
76
|
|
|
|
|
|
|
} |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
package Net::DNS::RR::SOA; |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub new_serial { |
|
82
|
0
|
|
|
0
|
0
|
|
my ($self, $inc) = @_; |
|
83
|
|
|
|
|
|
|
|
|
84
|
0
|
0
|
|
|
|
|
if($inc) { |
|
85
|
0
|
|
|
|
|
|
$self->serial += $inc; |
|
86
|
|
|
|
|
|
|
} else { |
|
87
|
0
|
|
|
|
|
|
my $newserial = strftime("%Y%m%d%H", localtime(time)); |
|
88
|
0
|
0
|
|
|
|
|
$self->serial = ($newserial > $self->serial) |
|
89
|
|
|
|
|
|
|
? $newserial |
|
90
|
|
|
|
|
|
|
: $self->serial + 1; |
|
91
|
|
|
|
|
|
|
} |
|
92
|
0
|
|
|
|
|
|
return $self->serial; |
|
93
|
|
|
|
|
|
|
} |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
1; |
|
97
|
|
|
|
|
|
|
|