TcpdmatchRD.pm

filter: Statementstmt 100% 28 / 28 Branchbran 75.0% 3 / 4 Conditioncond 71.4% 5 / 7 MC/DCmcdc 50.0% 2 / 4 Subroutinesub 100% 9 / 9 Podpod 33.3% 1 / 3 totaltotal 87.2% 48 / 55 CC 6 SCAR 9.7
CC
6
Cov
92%
tcpdmatch
5.2
check_file
2.0
BEGIN
1.0
CRAP 2.6
↑ Summary Tcpdmatch.pm »
1 # Copyright (c) 2003 Ioannis Tambouras <ioannis@earthlink.net> .
2 # All rights reserved.
3
4 package Authen::Tcpdmatch::TcpdmatchRD;
5  
6 11 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 11 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 11 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 11 ▶use base 'Exporter';
Subroutine BEGIN: called CC=1 SCAR=0.0
10 11 ▶use Attribute::Handlers;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 11 ▶use Authen::Tcpdmatch::Grammar;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13  
14 11 our $VERSION = '0.03';
15 11 our @EXPORT = qw( tcpdmatch check );
16  
17  
18 11 my Authen::Tcpdmatch::Grammar $p : TcpdParser ;
19  
20 83 ▶sub check {
Subroutine check: called CC=1 SCAR=0.0
Pod undocumented
21 83 my ( $input, $service, $remote ) = @_ ;
22 83 $p->Start( $input, 0 , $service, $remote );
23 }
24  
25  
26  
27 9 ▶sub check_file {
Subroutine check_file: called CC=2 SCAR=7.1
Pod undocumented
28 9 my ($service, $remote, $file) = @_;
29 9 ▶ local undef $/ , open (my $fh , $file) or return ;
Branch: 1 branch
BranchTrueFalseTotal
undef $/, open(my $fh, $file) or return 9 0 9
30 9 $p->Start( scalar <$fh> , 0 , $service , $remote );
31 }
32  
33 6 ▶sub tcpdmatch ($$;$) {
Subroutine tcpdmatch: called CC=5 SCAR=16.4
Pod documented
34 6 my ( $service, $remote, $dir) = @_ ;
35 6 ▶ (check_file $service, $remote, ($dir ||'/etc') . "/hosts.allow" ) or
Branch: 1 branch
BranchTrueFalseTotal
check_file($service, $remote, ($dir || "/etc") . '/hosts.allow') or not check_file($service, $remote, ($dir || "/etc") . '/hosts.deny') or undef 4 2 6
Condition71%5/7
check_file($service, $remote, ($dir || "/etc") . '/hosts.allow') or not check_file($service, $remote, ($dir || "/etc") . '/hosts.deny')
l!l&&r!l&&!r
312
$dir || '/etc'
l!l
60
$dir || '/etc'
l!l
30
MC/DC100%2/2
check_file($service, $remote, ($dir || "/etc") . '/hosts.allow') or not check_file($service, $remote, ($dir || "/etc") . '/hosts.deny')
check_file($service, $remote, ($dir || "/etc") . '/hosts.allow') not check_file($service, $remote, ($dir || "/etc") . '/hosts.deny')
MC/DC0%0/1
$dir || '/etc'
$dir
MC/DC0%0/1
$dir || '/etc'
$dir
Truth table100%3/3
A or not(B)
A= check_file($service, $remote, ($dir || "/etc") . '/hosts.allow')B= not check_file($service, $remote, ($dir || "/etc") . '/hosts.deny')
ABresult
1X1
011
000
Truth table50%1/2
A
A= $dir
Aresult
11
00
Truth table50%1/2
A
A= $dir
Aresult
11
00
36 ! (check_file $service, $remote, ($dir ||'/etc') . "/hosts.deny") or undef;
37 }
38  
39  
40 11 1;
41 __END__
↑ Summary Tcpdmatch.pm »