line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Authen::Tcpdmatch::Tcpdmatch; |
5
|
|
|
|
|
|
|
|
6
|
10
|
|
|
10
|
|
9193
|
use 5.006; |
|
10
|
|
|
|
|
40
|
|
|
10
|
|
|
|
|
406
|
|
7
|
10
|
|
|
10
|
|
53
|
use strict; |
|
10
|
|
|
|
|
17
|
|
|
10
|
|
|
|
|
334
|
|
8
|
10
|
|
|
10
|
|
50
|
use warnings; |
|
10
|
|
|
|
|
78
|
|
|
10
|
|
|
|
|
926
|
|
9
|
10
|
|
|
10
|
|
51
|
use base qw( Exporter ) ; |
|
10
|
|
|
|
|
16
|
|
|
10
|
|
|
|
|
1821
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
BEGIN { |
13
|
10
|
|
50
|
10
|
|
84
|
my $algorithm = $ENV{TCPDMATCH} || 'RD' ; |
14
|
|
|
|
|
|
|
|
15
|
10
|
|
|
10
|
|
744
|
eval "use Authen::Tcpdmatch::Tcpdmatch$algorithm" ; |
|
10
|
|
|
|
|
10258
|
|
|
10
|
|
|
|
|
32
|
|
|
10
|
|
|
|
|
1220
|
|
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
our $VERSION = '0.08'; |
20
|
|
|
|
|
|
|
our @EXPORT = qw( tcpdmatch check); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
1; |
26
|
|
|
|
|
|
|
__END__ |
27
|
|
|
|
|
|
|
=head1 NAME |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
Authen::Tcpdmatch - Perl extension for parsing hosts.allow and hosts.deny |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 SYNOPSIS |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
use Authen::Tcpdmatch; |
34
|
|
|
|
|
|
|
tcpdmatch( 'ftp', 'red.haw.org' ) |
35
|
|
|
|
|
|
|
tcpdmatch( 'ftp', '192.168.0.1' ) |
36
|
|
|
|
|
|
|
tcpdmatch( 'ftp', 'red.haw.org' , /etc ) |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 DESCRIPTION |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
This module in a front-end to the core functionality of tcpdmatch, which consults hosts.allow |
41
|
|
|
|
|
|
|
and hosts.deny to decide if service should be granted. |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
Its sole purpose is to choose load either TcpdmatchYapp (a yapp parser), or |
44
|
|
|
|
|
|
|
TcpdmatchRD ( a RecDescent parser) . In previous releases the default |
45
|
|
|
|
|
|
|
parser was yapp, but the default is now set to RecDecent since yapp is presently |
46
|
|
|
|
|
|
|
disabled. |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=for hide |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
The default action is to load |
51
|
|
|
|
|
|
|
the yapp parser since it is several times faster than RecDescent, and it |
52
|
|
|
|
|
|
|
is a lot easier to make it re-entrant. |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Set the environment variable TCPDMATCH to "RD" in order to use the RecDescent parser, |
55
|
|
|
|
|
|
|
or just ignore this module and load "use Authen::Tcpdmatch::TcpdmatchRD" instead. |
56
|
|
|
|
|
|
|
The use interface is the same for all Authen::Tcpdmatch::Tcpdmatch* modules. |
57
|
|
|
|
|
|
|
=end |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=over |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=item tcpdmatch() |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
The first and second arguments |
64
|
|
|
|
|
|
|
are the requested service and the name of remote host, respectively. The third |
65
|
|
|
|
|
|
|
(optional) argument indicates the directory of the hosts.* files. (Default is /etc .) |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=back |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head2 LIMITATIONS |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
It does not support shell commands, client lookups, endpoint patterns, spoofing attacks, |
72
|
|
|
|
|
|
|
and expansions. If these features are important to you, |
73
|
|
|
|
|
|
|
perhaps you should be using libwarp.so with Authen::Libwrap . |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head2 EXPORT |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
tcpdmatch |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 AUTHOR |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Ioannis Tambouras, E<lt>ioannis@earthlink.netE<gt> |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 SEE ALSO |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
L<Authen::libwrap>. |
86
|
|
|
|
|
|
|
L<hosts.allow(1)>. |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=cut |
89
|
|
|
|
|
|
|
|