blib/lib/ClearPress/authenticator/passwd.pm

filter: Statementstmt 100% 23 / 23 Branchbran 100% 6 / 6 Conditioncond 100% 6 / 6 MC/DCmcdc 100% 3 / 3 Subroutinesub 100% 5 / 5 Podpod 100% 1 / 1 totaltotal 100% 44 / 44 CC 6 SCAR 13.9
CC
6
Cov
100%
authen_credentials
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 4.0
« blib/lib/ClearPress/Localize.pm ↑ Summary blib/lib/ClearPress/authenticator/ldap.pm »
1 # -*- mode: cperl; tab-width: 8; indent-tabs-mode: nil; basic-offset: 2 -*-
2 # vim:ts=8:sw=2:et:sta:sts=2
3 #########
4 # Author: rmp
5 #
6 package ClearPress::authenticator::passwd;
7 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶use base qw(ClearPress::authenticator);
Subroutine BEGIN: called CC=1 SCAR=0.0
10 2 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 2 our $VERSION = q[2026.07.25];
13  
14 6 ▶sub authen_credentials {
Subroutine authen_credentials: called CC=6 SCAR=17.9
Pod documented
15 6 my ($self, $ref) = @_;
16  
17 6 ▶ if(!$ref ||
Branch: 1 branch
BranchTrueFalseTotal
unless ($ref and $ref->{"username"} and $ref->{"password"}) 3 3 6
Condition100%6/6
$ref and $ref->{"username"} and $ref->{"password"}
!ll&&!rl&&r
213
$ref and $ref->{"username"}
!ll&&!rl&&r
114
MC/DC100%3/3
$ref and $ref->{"username"} and $ref->{"password"}
$ref $ref->{"username"} $ref->{"password"}
Truth table100%4/4
A and B and C
A= $refB= $ref->{"username"}C= $ref->{"password"}
ABCresult
0XX0
10X0
1100
1111
18 !$ref->{username} ||
19 !$ref->{password} ) {
20 3 return;
21 }
22  
23 3 my ($name, $passwd) = getpwnam $ref->{username};
24 3 ▶ if(!$name) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($name) 1 2 3
25 1 return;
26 }
27  
28 2 ▶ if((crypt $ref->{password}, $passwd) eq $passwd) {
Branch: 1 branch
BranchTrueFalseTotal
if (crypt($ref->{"password"}, $passwd) eq $passwd) 1 1 2
29 1 return $ref;
30 }
31  
32 1 return;
33 }
34  
35 2 1;
36 __END__
« blib/lib/ClearPress/Localize.pm ↑ Summary blib/lib/ClearPress/authenticator/ldap.pm »