OMatic/AuthLocal.pm

filter: Statementstmt 40.0% 4 / 10 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 9 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 50.0% 1 / 2 Podpod 0.0% 0 / 1 totaltotal 17.8% 5 / 28 CC 5 SCAR 32.3
CC
5
Cov
19%
checkPassword
30.0
BEGIN
1.0
CRAP 25.2
« OMatic/Groups.pm ↑ Summary OMatic/ImageRef.pm »
1 ##############################################################################
2 # The Faq-O-Matic is Copyright 1997 by Jon Howell, all rights reserved. #
3 # #
4 # This program is free software; you can redistribute it and/or #
5 # modify it under the terms of the GNU General Public License #
6 # as published by the Free Software Foundation; either version 2 #
7 # of the License, or (at your option) any later version. #
8 # #
9 # This program is distributed in the hope that it will be useful, #
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
12 # GNU General Public License for more details. #
13 # #
14 # You should have received a copy of the GNU General Public License #
15 # along with this program; if not, write to the Free Software #
16 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.#
17 # #
18 # Jon Howell can be contacted at: #
19 # 6211 Sudikoff Lab, Dartmouth College #
20 # Hanover, NH 03755-3510 #
21 # jonh@cs.dartmouth.edu #
22 # #
23 # An electronic copy of the GPL is available at: #
24 # http://www.gnu.org/copyleft/gpl.html #
25 # #
26 ##############################################################################
27  
28 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
29  
30 package FAQ::OMatic::AuthLocal;
31  
32 # To implement a local authentication scheme, return a true value
33 # if the id and password are valid, else return a false value.
34 #
35 # (There should be a way for you to also hide or override the
36 # 'set a new password' mechanism, but there isn't as of this writing,
37 # version 2.504.)
38  
39 0 ▶sub checkPassword {
Subroutine checkPassword: not called CC=5 SCAR=34.0
Pod undocumented
40 0 my $id = shift;
41 0 my $pass = shift;
42  
43 0 my ($idf,$passf,@rest) = FAQ::OMatic::Auth::readIDfile($id);
44 0 ▶ if ((defined $idf)
Branch: 1 branch
BranchTrueFalseTotal
if (defined $idf and $idf eq $id and $passf ne "__INVALID__" and FAQ::OMatic::Auth::checkCryptPass($pass, $passf)) 0 0 0
Condition0%0/9
defined $idf and $idf eq $id and $passf ne "__INVALID__" and FAQ::OMatic::Auth::checkCryptPass($pass, $passf)
!ll&&!rl&&r
000
defined $idf and $idf eq $id and $passf ne "__INVALID__"
!ll&&!rl&&r
000
defined $idf and $idf eq $id
!ll&&!rl&&r
000
MC/DC0%0/4
defined $idf and $idf eq $id and $passf ne "__INVALID__" and FAQ::OMatic::Auth::checkCryptPass($pass, $passf)
defined $idf $idf eq $id $passf ne "__INVALID__" FAQ::OMatic::Auth::checkCryptPass($pass, $passf)
Truth table0%0/5
A and B and C and D
A= defined $idfB= $idf eq $idC= $passf ne "__INVALID__"D= FAQ::OMatic::Auth::checkCryptPass($pass, $passf)
ABCDresult
0XXX0
10XX0
110X0
11100
11111
45 and ($idf eq $id)
46 and ($passf ne '__INVALID__') # avoid the obvious vandal's hole...
47 and FAQ::OMatic::Auth::checkCryptPass($pass, $passf)) {
48 0 return 'true';
49 }
50  
51 0 return undef;
52 }
53  
54 1 1;
« OMatic/Groups.pm ↑ Summary OMatic/ImageRef.pm »