| 1 | package Aut::Backend::Conf; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | # $Id: Conf.pm,v 1.8 2004/04/09 13:05:14 cvs Exp $ | ||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use Config::Frontend; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use Aut::Ticket; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use Digest::MD5 qw(md5_base64); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 2 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 11 | 2 | my $class=shift; | |||||||||||||||||||||||||||
| 12 | 2 | my $conf=shift; | |||||||||||||||||||||||||||
| 13 | 2 | my $self; | |||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 2 | $self->{"conf"}=$conf; | |||||||||||||||||||||||||||
| 16 | 2 | bless $self,$class; | |||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 2 | return $self; | |||||||||||||||||||||||||||
| 19 | } | ||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 1 | ▶ | sub get_keys { | ||||||||||||||||||||||||||
|
Subroutine
get_keys: called CC=3 SCAR=14.2
Pod
documented
| |||||||||||||||||||||||||||||
| 22 | 1 | my $self=shift; | |||||||||||||||||||||||||||
| 23 | 1 | my $public=$self->{"conf"}->get("aut_keys.public"); | |||||||||||||||||||||||||||
| 24 | 1 | my $private=$self->{"conf"}->get("aut_keys.private"); | |||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 1 | ▶ | if ((not defined $public) or (not defined $private)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $public && defined $private
MC/DC0%0/2
defined $public && defined $private
defined $public
defined $private
Truth table33%1/3
A && B
A= defined $publicB= defined $private
| |||||||||||||||||||||||||||||
| 27 | 1 | return undef; | |||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||
| 29 | else { | ||||||||||||||||||||||||||||
| 30 | 0 | my @K; | |||||||||||||||||||||||||||
| 31 | 0 | push @K,$public; | |||||||||||||||||||||||||||
| 32 | 0 | push @K,$private; | |||||||||||||||||||||||||||
| 33 | 0 | return @K; | |||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 0 | ▶ | sub set_keys { | ||||||||||||||||||||||||||
|
Subroutine
set_keys: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 38 | 0 | my $self=shift; | |||||||||||||||||||||||||||
| 39 | 0 | my $public=shift; | |||||||||||||||||||||||||||
| 40 | 0 | my $private=shift; | |||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 0 | $self->{"conf"}->set("aut_keys.public",$public); | |||||||||||||||||||||||||||
| 43 | 0 | $self->{"conf"}->set("aut_keys.private",$private); | |||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | 0 | ▶ | sub has_accounts { | ||||||||||||||||||||||||||
|
Subroutine
has_accounts: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 47 | 0 | my $self=shift; | |||||||||||||||||||||||||||
| 48 | 0 | my @vars=$self->{"conf"}->variables(); | |||||||||||||||||||||||||||
| 49 | 0 | my $accounts=0; | |||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | 0 | for my $a (@vars) { | |||||||||||||||||||||||||||
| 52 | 0 | my ($pass,$account)=split /[.]/,$a,2; | |||||||||||||||||||||||||||
| 53 | 0 | ▶ | if ($pass eq "aut_pass") { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 54 | 0 | $accounts+=1; | |||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||
| 57 | 0 | return $accounts gt 0; | |||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | 0 | ▶ | sub get_all_accounts { | ||||||||||||||||||||||||||
|
Subroutine
get_all_accounts: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 61 | 0 | my $self=shift; | |||||||||||||||||||||||||||
| 62 | 0 | my @vars=$self->{"conf"}->variables(); | |||||||||||||||||||||||||||
| 63 | 0 | my @accounts; | |||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | 0 | for my $a (@vars) { | |||||||||||||||||||||||||||
| 66 | 0 | my ($pass,$account)=split /[.]/,$a,2; | |||||||||||||||||||||||||||
| 67 | 0 | ▶ | if ($pass eq "aut_pass") { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 68 | 0 | push @accounts,$account; | |||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||
| 71 | 0 | return @accounts; | |||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | ### | ||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | 0 | ▶ | sub internal_set { | ||||||||||||||||||||||||||
|
Subroutine
internal_set: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 77 | 0 | my ($self,$account,$val,$type)=@_; | |||||||||||||||||||||||||||
| 78 | 0 | $self->{"conf"}->set("aut_$type.$account",$val); | |||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | 0 | ▶ | sub internal_get { | ||||||||||||||||||||||||||
|
Subroutine
internal_get: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 82 | 0 | my ($self,$account,$type)=@_; | |||||||||||||||||||||||||||
| 83 | 0 | $self->{"conf"}->get("aut_$type.$account"); | |||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | 0 | ▶ | sub internal_del { | ||||||||||||||||||||||||||
|
Subroutine
internal_del: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 87 | 0 | my ($self,$account,$type)=@_; | |||||||||||||||||||||||||||
| 88 | 0 | $self->{"conf"}->del("aut_$type.$account"); | |||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||
| 91 | ### | ||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | 0 | ▶ | sub set { | ||||||||||||||||||||||||||
|
Subroutine
set: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 94 | 0 | my ($self,$account,$var,$val)=@_; | |||||||||||||||||||||||||||
| 95 | 0 | $self->internal_set($account,$val,"config.$var"); | |||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||
| 98 | 0 | ▶ | sub get { | ||||||||||||||||||||||||||
|
Subroutine
get: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 99 | 0 | my ($self,$account,$var)=@_; | |||||||||||||||||||||||||||
| 100 | 0 | $self->internal_get($account,"config.$var"); | |||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | 0 | ▶ | sub del { | ||||||||||||||||||||||||||
|
Subroutine
del: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 104 | 0 | my ($self,$account,$var)=@_; | |||||||||||||||||||||||||||
| 105 | 0 | $self->internal_del($account,"config.$var"); | |||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | 0 | ▶ | sub del_bag { | ||||||||||||||||||||||||||
|
Subroutine
del_bag: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 109 | 0 | my ($self,$account)=@_; | |||||||||||||||||||||||||||
| 110 | 0 | for my $var ($self->{"conf"}->variables()) { | |||||||||||||||||||||||||||
| 111 | 0 | ▶ | if ($var=~/^aut_config/ and $var=~/$account$/) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$var =~ /^aut_config/ and $var =~ /$account$/
MC/DC0%0/2
$var =~ /^aut_config/ and $var =~ /$account$/
$var =~ /^aut_config/
$var =~ /$account$/
Truth table0%0/3
A and B
A= $var =~ /^aut_config/B= $var =~ /$account$/
| |||||||||||||||||||||||||||||
| 112 | 0 | $self->{"conf"}->del($var); | |||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||
| 117 | ### | ||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||
| 119 | 0 | ▶ | sub set_pass { | ||||||||||||||||||||||||||
|
Subroutine
set_pass: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 120 | 0 | my ($self,$account,$pass)=@_; | |||||||||||||||||||||||||||
| 121 | 0 | $pass=md5_base64($pass); | |||||||||||||||||||||||||||
| 122 | 0 | $self->internal_set($account,$pass,"pass"); | |||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||
| 125 | 0 | ▶ | sub set_rsa_pass { internal_set(@_,"rsa_pass"); } | ||||||||||||||||||||||||||
|
Subroutine
set_rsa_pass: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 126 | 0 | ▶ | sub set_rights { internal_set(@_,"rights"); } | ||||||||||||||||||||||||||
|
Subroutine
set_rights: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 127 | 0 | ▶ | sub set_seed { internal_set(@_,"seed"); } | ||||||||||||||||||||||||||
|
Subroutine
set_seed: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 128 | 0 | ▶ | sub set_sr_hash{ internal_set(@_,"sr_hash"); } | ||||||||||||||||||||||||||
|
Subroutine
set_sr_hash: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||
| 130 | # There is no get_pass. Passwords are only checked | ||||||||||||||||||||||||||||
| 131 | 0 | ▶ | sub get_rsa_pass { internal_get(@_,"rsa_pass"); } | ||||||||||||||||||||||||||
|
Subroutine
get_rsa_pass: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 132 | 0 | ▶ | sub get_rights { internal_get(@_,"rights"); } | ||||||||||||||||||||||||||
|
Subroutine
get_rights: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 133 | 0 | ▶ | sub get_seed { internal_get(@_,"seed"); } | ||||||||||||||||||||||||||
|
Subroutine
get_seed: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 134 | 0 | ▶ | sub get_sr_hash { internal_get(@_,"sr_hash"); } | ||||||||||||||||||||||||||
|
Subroutine
get_sr_hash: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||
| 136 | 0 | ▶ | sub del_pass { internal_del(@_,"pass"); } | ||||||||||||||||||||||||||
|
Subroutine
del_pass: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 137 | 0 | ▶ | sub del_rsa_pass { internal_del(@_,"rsa_pass"); } | ||||||||||||||||||||||||||
|
Subroutine
del_rsa_pass: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 138 | 0 | ▶ | sub del_rights { internal_del(@_,"rights"); } | ||||||||||||||||||||||||||
|
Subroutine
del_rights: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 139 | 0 | ▶ | sub del_seed { internal_del(@_,"seed"); } | ||||||||||||||||||||||||||
|
Subroutine
del_seed: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 140 | 0 | ▶ | sub del_sr_hash { internal_del(@_,"sr_hash"); } | ||||||||||||||||||||||||||
|
Subroutine
del_sr_hash: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||
| 142 | 0 | ▶ | sub del_account { | ||||||||||||||||||||||||||
|
Subroutine
del_account: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 143 | 0 | del_pass(@_); | |||||||||||||||||||||||||||
| 144 | 0 | del_rsa_pass(@_); | |||||||||||||||||||||||||||
| 145 | 0 | del_rights(@_); | |||||||||||||||||||||||||||
| 146 | 0 | del_seed(@_); | |||||||||||||||||||||||||||
| 147 | 0 | del_sr_hash(@_); | |||||||||||||||||||||||||||
| 148 | 0 | del_bag(@_); | |||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||
| 151 | 0 | ▶ | sub pass_ok { | ||||||||||||||||||||||||||
|
Subroutine
pass_ok: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 152 | 0 | my ($self,$account,$pass)=@_; | |||||||||||||||||||||||||||
| 153 | 0 | $pass=md5_base64($pass); | |||||||||||||||||||||||||||
| 154 | 0 | my $stored_pass=$self->internal_get($account,"pass"); | |||||||||||||||||||||||||||
| 155 | 0 | return ($stored_pass eq $pass); | |||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||
| 158 | 0 | ▶ | sub exists { | ||||||||||||||||||||||||||
|
Subroutine
exists: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 159 | 0 | return (defined internal_get(@_,"pass")); | |||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||
| 162 | 1 | 1; | |||||||||||||||||||||||||||
| 163 | __END__ | ||||||||||||||||||||||||||||