| 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
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 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
Condition71%5/7
check_file($service, $remote, ($dir || "/etc") . '/hosts.allow') or not check_file($service, $remote, ($dir || "/etc") . '/hosts.deny')
$dir || '/etc'
$dir || '/etc'
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')
Truth table50%1/2
A
A= $dir
Truth table50%1/2
A
A= $dir
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | ! (check_file $service, $remote, ($dir ||'/etc') . "/hosts.deny") or undef; | ||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 11 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||
| 41 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||