Passphrase/AcceptAll.pm

filter: Statementstmt 100% 29 / 29 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 11 / 11 Podpod 100% 5 / 5 totaltotal 100% 47 / 47 CC 2 SCAR 1.5
CC
2
Cov
100%
from_crypt
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« Passphrase/RejectAll.pm ↑ Summary Passphrase/NTHash.pm »
1 =head1 NAME
2  
3 Authen::Passphrase::AcceptAll - accept any passphrase
4  
5 =head1 SYNOPSIS
6  
7 use Authen::Passphrase::AcceptAll;
8  
9 $ppr = Authen::Passphrase::AcceptAll->new;
10  
11 $ppr = Authen::Passphrase::AcceptAll
12 ->from_crypt("");
13  
14 $ppr = Authen::Passphrase::AcceptAll
15 ->from_rfc2307("{CRYPT}");
16  
17 if($ppr->match($passphrase)) { ...
18  
19 $passphrase = $ppr->passphrase;
20  
21 $passwd = $ppr->as_crypt;
22 $userPassword = $ppr->as_rfc2307;
23  
24 =head1 DESCRIPTION
25  
26 An object of this class is a passphrase recogniser that accepts any
27 passphrase whatsoever. This is a subclass of L<Authen::Passphrase>, and
28 this document assumes that the reader is familiar with the documentation
29 for that class.
30  
31 This type of passphrase recogniser is obviously of no use at all in
32 controlling access to any resource. Its use is to permit a resource to
33 be public in a system that expects some type of passphrase access control.
34  
35 =cut
36  
37 package Authen::Passphrase::AcceptAll;
38  
39 2 ▶{ use 5.006; }
Subroutine BEGIN: called CC=1 SCAR=0.0
40 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
41 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
42  
43 2 ▶use Authen::Passphrase 0.003;
Subroutine BEGIN: called CC=1 SCAR=0.0
44 2 ▶use Carp qw(croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
45  
46 2 our $VERSION = "0.009";
47  
48 2 ▶use parent "Authen::Passphrase";
Subroutine BEGIN: called CC=1 SCAR=0.0
49  
50 # There is only one object of this class, and its content is
51 # insignificant.
52  
53 =head1 CONSTRUCTORS
54  
55 =over
56  
57 =item Authen::Passphrase::AcceptAll->new
58  
59 Returns an accept-all passphrase recogniser object. The same object is
60 returned from each call.
61  
62 =cut
63  
64 {
65 2 my $singleton = bless({});
66 3 ▶ sub new { $singleton }
Subroutine new: called CC=1 SCAR=0.0
Pod documented
67 }
68  
69 =item Authen::Passphrase::AcceptAll->from_crypt("")
70  
71 Returns an accept-all passphrase recogniser object. The same object is
72 returned from each call. The argument must be the empty string.
73  
74 =cut
75  
76 2 ▶sub from_crypt {
Subroutine from_crypt: called CC=2 SCAR=6.9
Pod documented
77 4 my($class, $passwd) = @_;
78 4 ▶ return $class->new if $passwd eq "";
Branch: 1 branch
BranchTrueFalseTotal
if $passwd eq "" 2 2 4
79 2 return $class->SUPER::from_crypt($passwd);
80 }
81  
82 =item Authen::Passphrase::AcceptAll->from_rfc2307(USERPASSWORD)
83  
84 Generates a new accept-all passphrase recogniser object from an RFC
85 2307 string. The string must consist of "B<{CRYPT}>" (case insensitive)
86 followed by an acceptable crypt string.
87  
88 =back
89  
90 =head1 METHODS
91  
92 =over
93  
94 =item $ppr->match(PASSPHRASE)
95  
96 =item $ppr->passphrase
97  
98 =item $ppr->as_crypt
99  
100 =item $ppr->as_rfc2307
101  
102 These methods are part of the standard L<Authen::Passphrase> interface.
103 The L</match> method always returns true, and the L</passphrase> method
104 returns the empty string (the shortest of the infinite number of correct
105 passphrases).
106  
107 =cut
108  
109 5 ▶sub match { 1 }
Subroutine match: called CC=1 SCAR=0.0
Pod documented
110  
111 1 ▶sub passphrase { "" }
Subroutine passphrase: called CC=1 SCAR=0.0
Pod documented
112  
113 2 ▶sub as_crypt { "" }
Subroutine as_crypt: called CC=1 SCAR=0.0
Pod documented
114  
115 =back
116  
117 =head1 SEE ALSO
118  
119 L<Authen::Passphrase>
120  
121 =head1 AUTHOR
122  
123 Andrew Main (Zefram) <zefram@fysh.org>
124  
125 =head1 COPYRIGHT
126  
127 Copyright (C) 2006, 2007, 2009, 2010, 2012
128 Andrew Main (Zefram) <zefram@fysh.org>
129  
130 =head1 LICENSE
131  
132 This module is free software; you can redistribute it and/or modify it
133 under the same terms as Perl itself.
134  
135 =cut
136  
137 2 1;
« Passphrase/RejectAll.pm ↑ Summary Passphrase/NTHash.pm »