File Coverage

blib/lib/FAQ/OMatic/AuthLocal.pm
Criterion Covered Total %
statement 3 9 33.3
branch 0 2 0.0
condition 0 9 0.0
subroutine 1 2 50.0
pod 0 1 0.0
total 4 23 17.3


line stmt bran cond sub pod time code
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     1   5 use strict;
  1         2  
  1         136  
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             sub checkPassword {
40 0     0 0   my $id = shift;
41 0           my $pass = shift;
42              
43 0           my ($idf,$passf,@rest) = FAQ::OMatic::Auth::readIDfile($id);
44 0 0 0       if ((defined $idf)
      0        
      0        
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;