| 1 | package Aut; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | # $Id: Aut.pm,v 1.23 2004/04/11 19:17:10 cvs Exp $ | ||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use 5.006; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use Crypt::RSA; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use Crypt::RSA::Key::Public; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use Crypt::RSA::Key::Private; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 1 | ▶ | use Digest::MD5 qw(md5_base64); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 1 | ▶ | use Locale::Framework; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 1 | ▶ | use Config::Frontend; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 17 | 1 | ▶ | use Config::Backend::String; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 1 | ▶ | use Aut::Crypt; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 20 | 1 | ▶ | use Aut::Ticket; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 21 | 1 | ▶ | use Aut::UI::Console; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 22 | 1 | ▶ | use Aut::Base64; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 23 | 1 | ▶ | use Aut::Backend::Conf; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | 1 | our $VERSION = '0.11'; | |||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | 1 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=3 SCAR=11.2
Pod
documented
| |||||||||||||||||||||||||||||
| 28 | 1 | my $class=shift; | |||||||||||||||||||||||||||
| 29 | 1 | my $string=""; | |||||||||||||||||||||||||||
| 30 | 1 | my $args = { | |||||||||||||||||||||||||||
| 31 | Backend => new Aut::Backend::Conf( | ||||||||||||||||||||||||||||
| 32 | new Config::Frontend( | ||||||||||||||||||||||||||||
| 33 | new Config::Backend::String(\$string) | ||||||||||||||||||||||||||||
| 34 | ) | ||||||||||||||||||||||||||||
| 35 | ), | ||||||||||||||||||||||||||||
| 36 | UI => new Aut::UI::Console(), | ||||||||||||||||||||||||||||
| 37 | RSA_Bits => 1024, | ||||||||||||||||||||||||||||
| 38 | Levels => [ "admin", "mutate", "view" ], | ||||||||||||||||||||||||||||
| 39 | Adminlevel => "admin", | ||||||||||||||||||||||||||||
| 40 | @_ | ||||||||||||||||||||||||||||
| 41 | }; | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | 1 | my $backend=$args->{"Backend"}; | |||||||||||||||||||||||||||
| 44 | 1 | my $ui=$args->{"UI"}; | |||||||||||||||||||||||||||
| 45 | 1 | my $bits=$args->{"RSA_Bits"}; | |||||||||||||||||||||||||||
| 46 | 1 | my $self; | |||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | 1 | $self->{"string"}=\$string; | |||||||||||||||||||||||||||
| 49 | 1 | $self->{"status"}="NONE"; | |||||||||||||||||||||||||||
| 50 | 1 | $self->{"errmsg"}=""; | |||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | 0 | ▶ | if (not defined $backend) { die "You need to specify an Aut Backend"; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 53 | 0 | ▶ | if (not defined $ui) { die "You need to specify an Aut user interface"; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | 1 | $self->{"backend"}=$backend; | |||||||||||||||||||||||||||
| 56 | 1 | $self->{"ui"}=$ui; | |||||||||||||||||||||||||||
| 57 | 1 | $self->{"levels"}=$args->{"Levels"}; | |||||||||||||||||||||||||||
| 58 | 1 | $self->{"adminlevel"}=$args->{"Adminlevel"}; | |||||||||||||||||||||||||||
| 59 | 1 | $self->{"ui"}->initialize($self->{"levels"},$self->{"adminlevel"}); | |||||||||||||||||||||||||||
| 60 | 1 | $self->{"base64"}=new Aut::Base64(); | |||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | 1 | bless $self,$class; | |||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | 1 | $self->initialize($bits); | |||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | 0 | return $self; | |||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | ##################################################################### | ||||||||||||||||||||||||||||
| 70 | # Initializing | ||||||||||||||||||||||||||||
| 71 | ##################################################################### | ||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | # Internal function. | ||||||||||||||||||||||||||||
| 74 | # Used to initialize the subsystem. | ||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | 1 | ▶ | sub initialize { | ||||||||||||||||||||||||||
|
Subroutine
initialize: called CC=5 SCAR=26.7
Pod
undocumented
| |||||||||||||||||||||||||||||
| 77 | 1 | my $self=shift; | |||||||||||||||||||||||||||
| 78 | 1 | my $bits=shift; | |||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | 1 | ▶ | if (not defined $self->{"backend"}->get_keys()) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 81 | 1 | my $pass=$self->{"ui"}->ask_pass($self,_T("Initializing cryptography system.\n". | |||||||||||||||||||||||||||
| 82 | "Please provide a password for the global\n". | ||||||||||||||||||||||||||||
| 83 | "RSA key-pair. You need to keep this password\n". | ||||||||||||||||||||||||||||
| 84 | "secret and will have to remember it!")); | ||||||||||||||||||||||||||||
| 85 | 1 | ▶ | if (not defined $pass) { die "Cannot continue without password"; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | 0 | my $passagain=$self->{"ui"}->ask_pass($self,_T("Enter the RSA password again for verification.")); | |||||||||||||||||||||||||||
| 88 | 0 | ▶ | if ($pass ne $passagain) { die "Cannot continue with two different passwords"; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||
| 91 | 0 | $self->{"ui"}->message(_T("Generating keys, this will take some time...")."($bits bits)"); | |||||||||||||||||||||||||||
| 92 | 0 | my $rsa = new Crypt::RSA; | |||||||||||||||||||||||||||
| 93 | 0 | ▶ | my ($public,$private) =$rsa->keygen( | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 94 | Identity => 'Aut module', | ||||||||||||||||||||||||||||
| 95 | Size => $bits, | ||||||||||||||||||||||||||||
| 96 | Password => "", | ||||||||||||||||||||||||||||
| 97 | Verbosity => 0 | ||||||||||||||||||||||||||||
| 98 | ) or die $rsa->errstr(); | ||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||
| 101 | 0 | my $private_str=private_key_to_string($private); | |||||||||||||||||||||||||||
| 102 | 0 | $private_str="private,".$private_str; | |||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||
| 104 | 0 | my $cipher=new Aut::Crypt($pass); | |||||||||||||||||||||||||||
| 105 | 0 | $private_str=$cipher->encrypt($private_str); | |||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||
| 107 | 0 | my $public_str=public_key_to_string($public); | |||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||
| 109 | 0 | $public_str=$self->{"base64"}->encode($public_str); | |||||||||||||||||||||||||||
| 110 | 0 | $private_str=$self->{"base64"}->encode($private_str); | |||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||
| 112 | 0 | $self->{"backend"}->set_keys($public_str,$private_str); | |||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||
| 114 | 0 | $self->{"ui"}->message(_T("done.")); | |||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||
| 118 | ##################################################################### | ||||||||||||||||||||||||||||
| 119 | # Querying | ||||||||||||||||||||||||||||
| 120 | ##################################################################### | ||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||
| 122 | 0 | ▶ | sub has_accounts { | ||||||||||||||||||||||||||
|
Subroutine
has_accounts: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 123 | 0 | my $self=shift; | |||||||||||||||||||||||||||
| 124 | 0 | $self->{"backend"}->has_accounts(); | |||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||
| 127 | 0 | ▶ | sub is_admin { | ||||||||||||||||||||||||||
|
Subroutine
is_admin: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 128 | 0 | my $self=shift; | |||||||||||||||||||||||||||
| 129 | 0 | my $ticket=shift; | |||||||||||||||||||||||||||
| 130 | 0 | ▶ | return ($ticket->valid()) && ($ticket->rights() eq $self->{"adminlevel"}); | ||||||||||||||||||||||||||
|
Condition0%0/3
$ticket->valid && $ticket->rights eq $self->{'adminlevel'}
MC/DC0%0/2
$ticket->valid && $ticket->rights eq $self->{'adminlevel'}
$ticket->valid
$ticket->rights eq $self->{'adminlevel'}
Truth table0%0/3
A && B
A= $ticket->validB= $ticket->rights eq $self->{'adminlevel'}
| |||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||
| 133 | 0 | ▶ | sub status { | ||||||||||||||||||||||||||
|
Subroutine
status: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 134 | 0 | my $self=shift; | |||||||||||||||||||||||||||
| 135 | 0 | return $self->{"status"}; | |||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||
| 138 | 0 | ▶ | sub last_error { | ||||||||||||||||||||||||||
|
Subroutine
last_error: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 139 | 0 | my $self=shift; | |||||||||||||||||||||||||||
| 140 | 0 | return $self->{"errmsg"}; | |||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||
| 143 | 0 | ▶ | sub list_accounts { | ||||||||||||||||||||||||||
|
Subroutine
list_accounts: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 144 | 0 | my $self=shift; | |||||||||||||||||||||||||||
| 145 | 0 | return $self->{"backend"}->get_all_accounts(); | |||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||
| 148 | 0 | ▶ | sub exists { | ||||||||||||||||||||||||||
|
Subroutine
exists: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 149 | 0 | my $self=shift; | |||||||||||||||||||||||||||
| 150 | 0 | my $account=shift; | |||||||||||||||||||||||||||
| 151 | 0 | return $self->{"backend"}->exists($account); | |||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||
| 154 | ##################################################################### | ||||||||||||||||||||||||||||
| 155 | # Bag functionality --> Backend as Configuration file | ||||||||||||||||||||||||||||
| 156 | ##################################################################### | ||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||
| 158 | 0 | ▶ | sub set { | ||||||||||||||||||||||||||
|
Subroutine
set: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 159 | 0 | my ($self,$ticket,$var,$val) = @_; | |||||||||||||||||||||||||||
| 160 | 0 | $val=$ticket->encrypt($val); | |||||||||||||||||||||||||||
| 161 | 0 | $self->{"backend"}->set($ticket->account(),$var,$val); | |||||||||||||||||||||||||||
| 162 | } | ||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||
| 164 | 0 | ▶ | sub get { | ||||||||||||||||||||||||||
|
Subroutine
get: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 165 | 0 | my ($self,$ticket,$var) = @_; | |||||||||||||||||||||||||||
| 166 | 0 | my $val=$self->{"backend"}->get($ticket->account(),$var); | |||||||||||||||||||||||||||
| 167 | 0 | $val=$ticket->decrypt($val); | |||||||||||||||||||||||||||
| 168 | 0 | return $val; | |||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||
| 171 | 0 | ▶ | sub del { | ||||||||||||||||||||||||||
|
Subroutine
del: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 172 | 0 | my ($self,$ticket,$var) = @_; | |||||||||||||||||||||||||||
| 173 | 0 | $self->{"backend"}->del($ticket->account(),$var); | |||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||
| 176 | ##################################################################### | ||||||||||||||||||||||||||||
| 177 | # status and error | ||||||||||||||||||||||||||||
| 178 | ##################################################################### | ||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||
| 180 | ### Internal Functions | ||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||
| 182 | 0 | ▶ | sub set_status { | ||||||||||||||||||||||||||
|
Subroutine
set_status: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 183 | 0 | my ($self,$status)=@_; | |||||||||||||||||||||||||||
| 184 | 0 | $self->{"status"}=$status; | |||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||
| 187 | 0 | ▶ | sub set_error { | ||||||||||||||||||||||||||
|
Subroutine
set_error: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 188 | 0 | my ($self,$msg)=@_; | |||||||||||||||||||||||||||
| 189 | 0 | $self->{"errmsg"}=$msg; | |||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||
| 192 | ##################################################################### | ||||||||||||||||||||||||||||
| 193 | # rsa crypting/decrypting | ||||||||||||||||||||||||||||
| 194 | ##################################################################### | ||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||
| 196 | ### Internal Functions | ||||||||||||||||||||||||||||
| 197 | ### Using an undocumented feature here! | ||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||
| 199 | 0 | ▶ | sub public_key_to_string { | ||||||||||||||||||||||||||
|
Subroutine
public_key_to_string: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 200 | 0 | my $key=shift; | |||||||||||||||||||||||||||
| 201 | 0 | return $key->serialize(); | |||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||
| 204 | 0 | ▶ | sub string_to_public_key { | ||||||||||||||||||||||||||
|
Subroutine
string_to_public_key: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 205 | 0 | my $string=shift; | |||||||||||||||||||||||||||
| 206 | 0 | my $key=new Crypt::RSA::Key::Public; | |||||||||||||||||||||||||||
| 207 | 0 | my @pub; | |||||||||||||||||||||||||||
| 208 | 0 | push @pub,$string; | |||||||||||||||||||||||||||
| 209 | 0 | return $key->deserialize(String => \@pub); | |||||||||||||||||||||||||||
| 210 | } | ||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||
| 212 | 0 | ▶ | sub private_key_to_string { | ||||||||||||||||||||||||||
|
Subroutine
private_key_to_string: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 213 | 0 | my $key=shift; | |||||||||||||||||||||||||||
| 214 | 0 | return $key->serialize(); | |||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||
| 217 | 0 | ▶ | sub string_to_private_key { | ||||||||||||||||||||||||||
|
Subroutine
string_to_private_key: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 218 | 0 | my $string=shift; | |||||||||||||||||||||||||||
| 219 | 0 | my $key=new Crypt::RSA::Key::Private; | |||||||||||||||||||||||||||
| 220 | 0 | my @pub; | |||||||||||||||||||||||||||
| 221 | 0 | push @pub,$string; | |||||||||||||||||||||||||||
| 222 | 0 | return $key->deserialize(String => \@pub); | |||||||||||||||||||||||||||
| 223 | } | ||||||||||||||||||||||||||||
| 224 | ### Using an undocumented feature here! | ||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||
| 226 | 0 | ▶ | sub rsa_crypt { | ||||||||||||||||||||||||||
|
Subroutine
rsa_crypt: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 227 | 0 | my $self=shift; | |||||||||||||||||||||||||||
| 228 | 0 | my $text=shift; | |||||||||||||||||||||||||||
| 229 | 0 | my $rsa=new Crypt::RSA; | |||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||
| 231 | 0 | my ($public_str,$private_str)=$self->{"backend"}->get_keys(); | |||||||||||||||||||||||||||
| 232 | 0 | my $public; | |||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||
| 234 | 0 | $public_str=$self->{"base64"}->decode($public_str); | |||||||||||||||||||||||||||
| 235 | 0 | my $public=string_to_public_key($public_str); | |||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||
| 237 | 0 | $text=$rsa->encrypt( | |||||||||||||||||||||||||||
| 238 | Message => $text, | ||||||||||||||||||||||||||||
| 239 | Key => $public | ||||||||||||||||||||||||||||
| 240 | ); | ||||||||||||||||||||||||||||
| 241 | 0 | ▶ | if (not defined $text) { warn "cannot encrypt"; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||
| 243 | 0 | $text=$self->{"base64"}->encode($text); | |||||||||||||||||||||||||||
| 244 | 0 | return $text; | |||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||
| 247 | 0 | ▶ | sub rsa_decrypt { | ||||||||||||||||||||||||||
|
Subroutine
rsa_decrypt: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 248 | 0 | my $self=shift; | |||||||||||||||||||||||||||
| 249 | 0 | my $text=shift; | |||||||||||||||||||||||||||
| 250 | 0 | my $pass=shift; | |||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||
| 252 | 0 | my $rsa=new Crypt::RSA; | |||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||
| 254 | 0 | my ($public_str,$private_str)=$self->{"backend"}->get_keys(); | |||||||||||||||||||||||||||
| 255 | 0 | $private_str=$self->{"base64"}->decode($private_str); | |||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||
| 257 | 0 | ▶ | if (not defined $pass) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 258 | 0 | $pass=$self->{"ui"}->ask_pass($self,_T("Give the password for the account global RSA private key")); | |||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||
| 261 | 0 | ▶ | if (not defined $pass) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 262 | 0 | return undef; | |||||||||||||||||||||||||||
| 263 | } | ||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||
| 265 | 0 | my $cipher=new Aut::Crypt($pass); | |||||||||||||||||||||||||||
| 266 | 0 | $private_str=$cipher->decrypt($private_str); | |||||||||||||||||||||||||||
| 267 | 0 | ▶ | if (substr($private_str,0,8) ne "private,") { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 268 | 0 | return undef; | |||||||||||||||||||||||||||
| 269 | } | ||||||||||||||||||||||||||||
| 270 | else { | ||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||
| 272 | 0 | $private_str=substr($private_str,8,length($private_str)); | |||||||||||||||||||||||||||
| 273 | 0 | my $private=string_to_private_key($private_str); | |||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||
| 275 | 0 | $text=$self->{"base64"}->decode($text); | |||||||||||||||||||||||||||
| 276 | 0 | $text=$rsa->decrypt( | |||||||||||||||||||||||||||
| 277 | Cyphertext => $text, | ||||||||||||||||||||||||||||
| 278 | Key => $private, | ||||||||||||||||||||||||||||
| 279 | ); | ||||||||||||||||||||||||||||
| 280 | 0 | ▶ | if (not defined $text) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 281 | 0 | warn "Unexpected! Cannot decrypt text with good private key!"; | |||||||||||||||||||||||||||
| 282 | } | ||||||||||||||||||||||||||||
| 283 | 0 | return $text; | |||||||||||||||||||||||||||
| 284 | } | ||||||||||||||||||||||||||||
| 285 | } | ||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||
| 287 | 0 | ▶ | sub check_rsa_private_pass { | ||||||||||||||||||||||||||
|
Subroutine
check_rsa_private_pass: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 288 | 0 | my $self=shift; | |||||||||||||||||||||||||||
| 289 | 0 | my $pass=shift; | |||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||
| 291 | 0 | my ($public_str,$private_str)=$self->{"backend"}->get_keys(); | |||||||||||||||||||||||||||
| 292 | 0 | $private_str=$self->{"base64"}->decode($private_str); | |||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||
| 294 | 0 | my $cipher=new Aut::Crypt($pass); | |||||||||||||||||||||||||||
| 295 | 0 | $private_str=$cipher->decrypt($private_str); | |||||||||||||||||||||||||||
| 296 | 0 | ▶ | if (substr($private_str,0,8) ne "private,") { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 297 | 0 | return 0; | |||||||||||||||||||||||||||
| 298 | } | ||||||||||||||||||||||||||||
| 299 | else { | ||||||||||||||||||||||||||||
| 300 | 0 | return 1; | |||||||||||||||||||||||||||
| 301 | } | ||||||||||||||||||||||||||||
| 302 | } | ||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||
| 304 | ### Internal Functions | ||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||
| 306 | ################################################################ | ||||||||||||||||||||||||||||
| 307 | # Account handling | ||||||||||||||||||||||||||||
| 308 | ##################################################################### | ||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||
| 310 | 0 | ▶ | sub ticket_create { | ||||||||||||||||||||||||||
|
Subroutine
ticket_create: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 311 | 0 | my $self=shift; | |||||||||||||||||||||||||||
| 312 | 0 | $self->ticket_update(@_); | |||||||||||||||||||||||||||
| 313 | } | ||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||
| 315 | 0 | ▶ | sub ticket_update { | ||||||||||||||||||||||||||
|
Subroutine
ticket_update: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 316 | 0 | my $self=shift; | |||||||||||||||||||||||||||
| 317 | 0 | my $ticket=shift; | |||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||
| 319 | 0 | my $account=$ticket->account(); | |||||||||||||||||||||||||||
| 320 | 0 | my $pass=$ticket->pass(); | |||||||||||||||||||||||||||
| 321 | 0 | my $rights=$ticket->rights(); | |||||||||||||||||||||||||||
| 322 | 0 | my $seed=$ticket->seed(); | |||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||
| 324 | #my $md5pass=md5_base64($pass); | ||||||||||||||||||||||||||||
| 325 | 0 | my $rsapass=$self->rsa_crypt($pass); | |||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||
| 327 | 0 | my $cipher=new Aut::Crypt($pass); | |||||||||||||||||||||||||||
| 328 | 0 | my $crypt_seed=$cipher->encrypt($seed); | |||||||||||||||||||||||||||
| 329 | 0 | my $b64_seed=$self->{"base64"}->encode($crypt_seed); | |||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||
| 331 | #$self->{"backend"}->set_md5pass($account,$md5pass); | ||||||||||||||||||||||||||||
| 332 | #$self->{"backend"}->set_pass($account,$rsapass); | ||||||||||||||||||||||||||||
| 333 | 0 | $self->{"backend"}->set_pass($account,$pass); | |||||||||||||||||||||||||||
| 334 | 0 | $self->{"backend"}->set_rsa_pass($account,$rsapass); | |||||||||||||||||||||||||||
| 335 | 0 | $self->{"backend"}->set_rights($account,$rights); | |||||||||||||||||||||||||||
| 336 | 0 | $self->{"backend"}->set_seed($account,$b64_seed); | |||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||
| 338 | 0 | my $to_hash="$rights$b64_seed"; | |||||||||||||||||||||||||||
| 339 | 0 | my $hash=md5_base64($to_hash); | |||||||||||||||||||||||||||
| 340 | 0 | $self->{"backend"}->set_sr_hash($account,$hash); | |||||||||||||||||||||||||||
| 341 | } | ||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||
| 343 | 0 | ▶ | sub ticket_get { | ||||||||||||||||||||||||||
|
Subroutine
ticket_get: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||
| 344 | 0 | my $self=shift; | |||||||||||||||||||||||||||
| 345 | 0 | my $account=shift; | |||||||||||||||||||||||||||
| 346 | 0 | my $pass=shift; | |||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||
| 348 | 0 | ▶ | if (not defined $pass) { $pass=""; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||
| 350 | 0 | my $ticket=new Aut::Ticket($account,$pass); | |||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||
| 352 | 0 | ▶ | if (not $self->{"backend"}->exists($account)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 353 | 0 | $ticket->invalidate(); | |||||||||||||||||||||||||||
| 354 | 0 | $self->set_error(_T("Account does not exist :").$account); | |||||||||||||||||||||||||||
| 355 | 0 | $self->set_status("ENOEXIST"); | |||||||||||||||||||||||||||
| 356 | 0 | return $ticket; | |||||||||||||||||||||||||||
| 357 | } | ||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||
| 359 | #my $stored_pass=$self->{"backend"}->get_md5pass($account); | ||||||||||||||||||||||||||||
| 360 | #my $md5pass=md5_base64($pass); | ||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||
| 362 | 0 | ▶ | if (not $self->{"backend"}->pass_ok($account,$pass)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 363 | 0 | $ticket->invalidate(); | |||||||||||||||||||||||||||
| 364 | 0 | $self->set_error(_T("Invalid password for :").$account); | |||||||||||||||||||||||||||
| 365 | 0 | $self->set_status("EBADPASS"); | |||||||||||||||||||||||||||
| 366 | } | ||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||
| 368 | 0 | my $rights=$self->{"backend"}->get_rights($account); | |||||||||||||||||||||||||||
| 369 | 0 | my $seed=$self->{"backend"}->get_seed($account); | |||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||
| 371 | 0 | my $to_hash="$rights$seed"; | |||||||||||||||||||||||||||
| 372 | 0 | my $hash=md5_base64($to_hash); | |||||||||||||||||||||||||||
| 373 | 0 | ▶ | if (($hash ne $self->{"backend"}->get_sr_hash($account)) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$hash ne $self->{"backend"}->get_sr_hash($account) and $ticket->valid
MC/DC0%0/2
$hash ne $self->{"backend"}->get_sr_hash($account) and $ticket->valid
$hash ne $self->{"backend"}->get_sr_hash($account)
$ticket->valid
Truth table0%0/3
A and B
A= $hash ne $self->{"backend"}->get_sr_hash($account)B= $ticket->valid
| |||||||||||||||||||||||||||||
| 374 | and | ||||||||||||||||||||||||||||
| 375 | $ticket->valid() | ||||||||||||||||||||||||||||
| 376 | ) { | ||||||||||||||||||||||||||||
| 377 | 0 | $self->set_error(_T("seed or rights have been modified for account ").$account); | |||||||||||||||||||||||||||
| 378 | 0 | $self->set_status("EBADINFO"); | |||||||||||||||||||||||||||
| 379 | 0 | $ticket->invalidate(); | |||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||
| 381 | } | ||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||
| 383 | 0 | $seed=$self->{"base64"}->decode($seed); | |||||||||||||||||||||||||||
| 384 | 0 | my $cipher=new Aut::Crypt($pass); | |||||||||||||||||||||||||||
| 385 | 0 | $seed=$cipher->decrypt($seed); | |||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||
| 387 | 0 | $ticket->set_rights($rights); | |||||||||||||||||||||||||||
| 388 | 0 | $ticket->set_seed($seed); | |||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||
| 390 | 0 | return $ticket; | |||||||||||||||||||||||||||
| 391 | } | ||||||||||||||||||||||||||||
| 392 | |||||||||||||||||||||||||||||
| 393 | 0 | ▶ | sub ticket_remove { | ||||||||||||||||||||||||||
|
Subroutine
ticket_remove: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 394 | 0 | my $self=shift; | |||||||||||||||||||||||||||
| 395 | 0 | my $ticket=shift; | |||||||||||||||||||||||||||
| 396 | 0 | $self->{"backend"}->del_account($ticket->account()); | |||||||||||||||||||||||||||
| 397 | 0 | $ticket->invalidate(); | |||||||||||||||||||||||||||
| 398 | } | ||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||
| 400 | ##################################################################### | ||||||||||||||||||||||||||||
| 401 | # Administrator functions | ||||||||||||||||||||||||||||
| 402 | ##################################################################### | ||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||
| 404 | 0 | ▶ | sub ticket_admin_get { | ||||||||||||||||||||||||||
|
Subroutine
ticket_admin_get: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||
| 405 | 0 | my $self=shift; | |||||||||||||||||||||||||||
| 406 | 0 | my $user_account=shift; | |||||||||||||||||||||||||||
| 407 | 0 | my $pass=shift; | |||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||
| 409 | 0 | ▶ | if (not $self->{"backend"}->exists($user_account)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 410 | 0 | my $ticket=new Aut::Ticket($user_account,""); | |||||||||||||||||||||||||||
| 411 | 0 | $ticket->invalidate(); | |||||||||||||||||||||||||||
| 412 | 0 | return $ticket; | |||||||||||||||||||||||||||
| 413 | } | ||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||
| 415 | 0 | my $user_pass=$self->{"backend"}->get_rsa_pass($user_account); | |||||||||||||||||||||||||||
| 416 | 0 | ▶ | if (defined $pass) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 417 | 0 | $user_pass=$self->rsa_decrypt($user_pass,$pass); | |||||||||||||||||||||||||||
| 418 | } | ||||||||||||||||||||||||||||
| 419 | else { | ||||||||||||||||||||||||||||
| 420 | 0 | $user_pass=$self->rsa_decrypt($user_pass); | |||||||||||||||||||||||||||
| 421 | } | ||||||||||||||||||||||||||||
| 422 | |||||||||||||||||||||||||||||
| 423 | 0 | ▶ | if (not defined $user_pass) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 424 | 0 | $self->{"ui"}->message_ok(_T("With the RSA password you gave,\nthe password for account '$user_account' could not be decrypted")); | |||||||||||||||||||||||||||
| 425 | 0 | my $ticket=new Aut::Ticket($user_account,""); | |||||||||||||||||||||||||||
| 426 | 0 | $ticket->invalidate(); | |||||||||||||||||||||||||||
| 427 | 0 | return $ticket; | |||||||||||||||||||||||||||
| 428 | } | ||||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||
| 430 | 0 | return $self->ticket_get($user_account,$user_pass); | |||||||||||||||||||||||||||
| 431 | } | ||||||||||||||||||||||||||||
| 432 | |||||||||||||||||||||||||||||
| 433 | 0 | ▶ | sub ticket_all_admin_get { | ||||||||||||||||||||||||||
|
Subroutine
ticket_all_admin_get: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||
| 434 | 0 | my $self=shift; | |||||||||||||||||||||||||||
| 435 | 0 | my @accounts=$self->{"backend"}->get_all_accounts(); | |||||||||||||||||||||||||||
| 436 | 0 | my @tickets; | |||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||
| 438 | 0 | my $pass=$self->{"ui"}->ask_pass($self,_T("Give the password for the secret RSA key")); | |||||||||||||||||||||||||||
| 439 | 0 | ▶ | if (not defined $pass) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 440 | 0 | $self->{"ui"}->message_ok(_T("You need to specify a password for the secret RSA key")); | |||||||||||||||||||||||||||
| 441 | 0 | return undef; | |||||||||||||||||||||||||||
| 442 | } | ||||||||||||||||||||||||||||
| 443 | elsif (not $self->check_rsa_private_pass($pass)) { | ||||||||||||||||||||||||||||
| 444 | 0 | $self->{"ui"}->message_ok(_T("The given password for the secret RSA key is not valid")); | |||||||||||||||||||||||||||
| 445 | 0 | return undef; | |||||||||||||||||||||||||||
| 446 | } | ||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||
| 448 | 0 | for my $a (@accounts) { | |||||||||||||||||||||||||||
| 449 | 0 | my $ticket=$self->ticket_admin_get($a,$pass); | |||||||||||||||||||||||||||
| 450 | 0 | push @tickets,$ticket; | |||||||||||||||||||||||||||
| 451 | } | ||||||||||||||||||||||||||||
| 452 | |||||||||||||||||||||||||||||
| 453 | 0 | return @tickets; | |||||||||||||||||||||||||||
| 454 | } | ||||||||||||||||||||||||||||
| 455 | |||||||||||||||||||||||||||||
| 456 | ##################################################################### | ||||||||||||||||||||||||||||
| 457 | # User Interface functions | ||||||||||||||||||||||||||||
| 458 | ##################################################################### | ||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||
| 460 | 0 | ▶ | sub login { | ||||||||||||||||||||||||||
|
Subroutine
login: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 461 | 0 | my $self=shift; | |||||||||||||||||||||||||||
| 462 | 0 | return $self->{"ui"}->login($self,@_); | |||||||||||||||||||||||||||
| 463 | } | ||||||||||||||||||||||||||||
| 464 | |||||||||||||||||||||||||||||
| 465 | 0 | ▶ | sub logout { | ||||||||||||||||||||||||||
|
Subroutine
logout: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 466 | 0 | my $self=shift; | |||||||||||||||||||||||||||
| 467 | 0 | my $ticket=shift; | |||||||||||||||||||||||||||
| 468 | 0 | ▶ | if ($self->{"ui"}->logout($self,$ticket,@_)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 469 | 0 | $ticket->invalidate(); | |||||||||||||||||||||||||||
| 470 | } | ||||||||||||||||||||||||||||
| 471 | } | ||||||||||||||||||||||||||||
| 472 | |||||||||||||||||||||||||||||
| 473 | 0 | ▶ | sub admin { | ||||||||||||||||||||||||||
|
Subroutine
admin: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 474 | 0 | my $self=shift; | |||||||||||||||||||||||||||
| 475 | 0 | my $ticket=shift; | |||||||||||||||||||||||||||
| 476 | 0 | ▶ | if ($self->is_admin($ticket)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 477 | 0 | $self->{"ui"}->admin($self,$ticket,@_); | |||||||||||||||||||||||||||
| 478 | } | ||||||||||||||||||||||||||||
| 479 | else { | ||||||||||||||||||||||||||||
| 480 | 0 | $self->{"ui"}->message_ok(_T("You don't have administrator rights.\nYou cannot do administration of accounts.")); | |||||||||||||||||||||||||||
| 481 | } | ||||||||||||||||||||||||||||
| 482 | } | ||||||||||||||||||||||||||||
| 483 | |||||||||||||||||||||||||||||
| 484 | 0 | ▶ | sub change_pass { | ||||||||||||||||||||||||||
|
Subroutine
change_pass: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 485 | 0 | my $self=shift; | |||||||||||||||||||||||||||
| 486 | 0 | my $ticket=shift; | |||||||||||||||||||||||||||
| 487 | 0 | ▶ | if ($ticket->valid()) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 488 | 0 | $self->{"ui"}->change_pass($self,$ticket,@_); | |||||||||||||||||||||||||||
| 489 | } | ||||||||||||||||||||||||||||
| 490 | else { | ||||||||||||||||||||||||||||
| 491 | 0 | $self->{"ui"}->message_ok(_T("You don't have a valid ticket. You cannot change your password")); | |||||||||||||||||||||||||||
| 492 | } | ||||||||||||||||||||||||||||
| 493 | } | ||||||||||||||||||||||||||||
| 494 | |||||||||||||||||||||||||||||
| 495 | ##################################################################### | ||||||||||||||||||||||||||||
| 496 | # UI Call back support functions | ||||||||||||||||||||||||||||
| 497 | ##################################################################### | ||||||||||||||||||||||||||||
| 498 | |||||||||||||||||||||||||||||
| 499 | 0 | ▶ | sub check_pass { | ||||||||||||||||||||||||||
|
Subroutine
check_pass: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||
| 500 | 0 | my $self=shift; | |||||||||||||||||||||||||||
| 501 | 0 | my $pass=shift; | |||||||||||||||||||||||||||
| 502 | |||||||||||||||||||||||||||||
| 503 | 0 | ▶ | if (not defined $pass) { $pass=""; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 504 | |||||||||||||||||||||||||||||
| 505 | 0 | my $status=undef; | |||||||||||||||||||||||||||
| 506 | 0 | my $str=""; | |||||||||||||||||||||||||||
| 507 | |||||||||||||||||||||||||||||
| 508 | 0 | ▶ | if (length($pass) lt 6) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 509 | 0 | $status="EBADPASS"; | |||||||||||||||||||||||||||
| 510 | 0 | $str=return "A password must be at least 6 characters"; | |||||||||||||||||||||||||||
| 511 | } | ||||||||||||||||||||||||||||
| 512 | |||||||||||||||||||||||||||||
| 513 | 0 | ▶ | if (defined $status) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 514 | 0 | $self->set_status($status); | |||||||||||||||||||||||||||
| 515 | 0 | $self->set_error($status); | |||||||||||||||||||||||||||
| 516 | } | ||||||||||||||||||||||||||||
| 517 | |||||||||||||||||||||||||||||
| 518 | 0 | return $str; | |||||||||||||||||||||||||||
| 519 | } | ||||||||||||||||||||||||||||
| 520 | |||||||||||||||||||||||||||||
| 521 | 1 | 1; | |||||||||||||||||||||||||||
| 522 | __END__ | ||||||||||||||||||||||||||||