blib/lib/Net/SSH/Perl/Auth.pm

filter: Statementstmt 29.0% 16 / 55 Branchbran 0.0% 0 / 14 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 35.7% 5 / 14 Podpod 75.0% 6 / 8 totaltotal 28.1% 27 / 96 SCAR 42.2
CC
11
Cov
22%
supported
30.0
_determine_supported
12.0
mgr
6.0
CRAP 67.9
« blib/lib/Net/SSH/Perl/Comp/Zlib.pm ↑ Summary blib/lib/Net/SSH/Perl/Auth/ChallengeResponse.pm »
1 package Net::SSH::Perl::Auth;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use Carp qw( croak );
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 ▶use vars qw( %AUTH %AUTH_REVERSE @AUTH_ORDER %SUPPORTED );
Subroutine BEGIN: called CC=1 SCAR=0.0
8 BEGIN {
9 1 ▶ %AUTH = (
Subroutine BEGIN: called CC=1 SCAR=0.0
10 Rhosts => 1,
11 RSA => 2,
12 Password => 3,
13 Rhosts_RSA => 4,
14 ChallengeResponse => 5,
15 Kerberos => 6,
16 Kerberos_TGT => 7,
17 );
18 1 %AUTH_REVERSE = reverse %AUTH;
19  
20 1 @AUTH_ORDER = qw( 7 6 1 4 2 5 3 );
21 }
22  
23 sub _determine_supported {
24 0 ▶ for my $auth (keys %AUTH) {
Subroutine _determine_supported: not called CC=3 SCAR=24.8
25 0 my $pack = sprintf "%s::%s", __PACKAGE__, $auth;
26 0 eval "use $pack";
27 0 ▶ $SUPPORTED{$AUTH{$auth}}++ unless $@;
Branch: 1 branch
BranchTrueFalseTotal
unless $@ 0 0 0
28 }
29 }
30  
31 sub new {
32 0 ▶ my $class = shift;
Subroutine new: not called CC=1 SCAR=6.9
Pod documented
33 0 my $type = shift;
34 0 my $auth_class = join '::', __PACKAGE__, $type;
35 0 (my $lib = $auth_class . ".pm") =~ s!::!/!g;
36 0 require $lib;
37 0 $auth_class->new(@_);
38 }
39  
40 ## For SSH2: mgr is Net::SSH::Perl::AuthMgr object.
41 sub mgr {
42 0 ▶ my $auth = shift;
Subroutine mgr: not called CC=2 SCAR=17.9
Pod undocumented
43 0 ▶ $auth->{mgr} = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
44 0 $auth->{mgr};
45 }
46  
47 sub id {
48 0 ▶ my $this = shift;
Subroutine id: not called CC=2 SCAR=17.9
Pod documented
49 0 my $type;
50 0 ▶ if (my $class = ref $this) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $class = ref $this) { } 0 0 0
51 0 my $pack = __PACKAGE__;
52 0 ($type = $class) =~ s/^${pack}:://;
53 }
54 else {
55 0 $type = $this;
56 }
57 0 $AUTH{$type};
58 }
59  
60 sub name {
61 0 ▶ my $this = shift;
Subroutine name: not called CC=2 SCAR=17.9
Pod documented
62 0 my $name;
63 0 ▶ if (my $class = ref $this) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $class = ref $this) { } 0 0 0
64 0 my $pack = __PACKAGE__;
65 0 ($name = $class) =~ s/^${pack}:://;
66 }
67 else {
68 0 $name = $AUTH_REVERSE{$this};
69 }
70 0 $name;
71 }
72  
73 sub mask {
74 0 ▶ my $mask = 0;
Subroutine mask: not called CC=2 SCAR=17.9
Pod undocumented
75 0 $mask |= (1<<$_) for keys %SUPPORTED;
76 0 $mask;
77 }
78  
79 sub supported {
80 0 ▶ unless (keys %SUPPORTED) {
Subroutine supported: not called CC=5 SCAR=34.0
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
unless (keys %Net::SSH::Perl::Auth::SUPPORTED) 0 0 0
81 0 _determine_supported();
82 }
83 0 ▶ return [ keys %SUPPORTED ] unless @_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 0 0 0
84 0 my $id = shift;
85 0 ▶ return $id == 0 || exists $SUPPORTED{$id} unless @_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 0 0 0
Condition0%0/3
$id == 0 || exists $Net::SSH::Perl::Auth::SUPPORTED{$id}
l!l&&r!l&&!r
000
MC/DC0%0/2
$id == 0 || exists $Net::SSH::Perl::Auth::SUPPORTED{$id}
$id == 0 exists $Net::SSH::Perl::Auth::SUPPORTED{$id}
Truth table0%0/3
A || B
A= $id == 0B= exists $Net::SSH::Perl::Auth::SUPPORTED{$id}
ABresult
1X1
011
000
86 0 my $ssupp = shift;
87 0 mask() & $ssupp & (1 << $id);
88 }
89  
90 0 ▶sub auth_order { \@AUTH_ORDER }
Subroutine auth_order: not called CC=1 SCAR=6.9
Pod documented
91  
92 0 ▶sub authenticate { 0 }
Subroutine authenticate: not called CC=1 SCAR=6.9
Pod documented
93  
94 1 1;
95 __END__
« blib/lib/Net/SSH/Perl/Comp/Zlib.pm ↑ Summary blib/lib/Net/SSH/Perl/Auth/ChallengeResponse.pm »