Branch Coverage

blib/lib/CGI/Ex/Auth.pm
Criterion Covered Total %
branch 168 326 51.5


line true false branch
32 0 1 @_ % 2 ? :
31 1 ref $_[0] ? :
38 18 11 unless ref $self
42 0 29 if ($self->script_name . $self->path_info eq $self->js_uri_path . "/CGI/Ex/md5.js")
51 0 29 if ($$form{$self->key_logout} and not $self->{'_logout_looking_for_user'})
59 0 0 if ($self->bounce_on_logout) { }
61 0 0 if $self->cookies->{$key_c}
62 0 0 $self->last_auth_data ? :
63 0 0 defined $user ? :
77 15 14 if (defined $form_user)
78 0 15 if (delete $$form{$self->key_loggedout}) { }
8 7 elsif (defined $$form{$self->key_pass}) { }
0 7 elsif (not length $form_user) { }
85 0 8 delete $$form{$self->key_save} ? :
97 17 2 if (not ref $data or $data->error and $data->{'allow_cookie_match'})
100 9 8 if (defined $cookie and length $cookie)
103 3 6 if (defined $form_user)
105 2 1 unless ($data and $self->check_form_user_against_cookie($user, $data->{'user'}, $data))
107 2 0 unless defined $data->{'user'}
114 13 16 unless ($data)
122 5 11 if ($self->use_plaintext or $data->{'type'} and $data->{'type'} eq "crypt")
123 3 0 unless defined $use_session or defined $data->{'expires_min'}
126 5 11 $use_session ? :
131 10 6 $data->{'from'} eq 'form' ? :
137 0 16 if (my $meth = $self->{'handle_success'})
143 0 16 if (my $redirect = $$form{$self->key_redirect}) { }
16 0 elsif (scalar keys %{$self->cookies;} or $self->no_cookie_verify) { }
0 0 elsif ($args->{'is_form'}) { }
166 0 16 if (my $meth = $self->{'success_hook'})
174 0 0 if (my $meth = $self->{'logout_hook'})
183 0 13 if (my $meth = $self->{'handle_failure'})
190 4 9 if exists $self->cookies->{$key_c}
193 0 13 if (my $value = delete $$form{$self->key_verify})
194 0 0 if (abs time - $value < 15)
206 5 1 defined $data ? :
209 0 5 if defined $data and $data->error ne "Login expired" and $self->failed_sleep
217 0 6 if (my $meth = $self->{'failure_hook'})
225 0 0 unless ref $self
229 0 0 $self->{'no_set_cookie'} ? :
235 0 0 unless +(shift())->{'script_name'} or $ENV{'SCRIPT_NAME'}
237 55 0 unless +(shift())->{'path_info'} or $ENV{'PATH_INFO'}
243 0 7 if @_ == 1
249 0 71 if @_ == 1
255 0 50 if @_ == 1
262 0 0 if $self->{'delete_cookie'}
265 0 0 if (my $dom = $ENV{'HTTP_HOST'})
282 3 4 if $self->{'set_cookie'}
297 1 3 $dom ? :
1 3 $sec ? :
0 4 $http ? :
2 2 $same ? :
0 4 $args->{'expires'} ? :
305 0 0 if $self->{'location_bounce'}
328 29 4 unless $s->use_crypt
329 18 3 unless defined $s->{'use_base64'}
330 28 0 unless defined $s->{'expires_min'}
343 0 0 length $user ? :
356 0 0 if $self->{'no_cookies_print'}
367 8 0 if (my $meth = $self->{'login_print'})
377 0 0 unless $t->process_simple($file, $hash, \$out)
400 0 0 unless $_[0]{'template_include_path'}
406 8 5 unless ref $data
422 4 9 $form->{'had_form_data'} ? :
439 0 24 if (my $meth = $self->{'verify_token'})
442 0 24 unless length $token
447 8 16 if (ref $token) { }
0 16 elsif (my $meth = $self->{'parse_token'}) { }
451 0 0 unless (&$meth($self, $args))
452 0 0 unless $data->error
457 3 13 unless ($self->parse_token($token, $data))
458 3 0 unless $data->error
466 0 21 if (not defined $data->{'user'}) { }
0 21 elsif (not defined($data->{'user'} = $self->cleanup_user($data->{'user'})) && length $data->{'user'}) { }
0 21 elsif (not defined $data->{'test_pass'}) { }
0 21 elsif (not $self->verify_user($data->{'user'})) { }
476 0 21 if $data->error
480 0 21 if (not defined($pass = eval { do { $self->get_pass_by_user($data->{'user'}) } })) { }
2 19 elsif (ref $pass eq 'HASH') { }
487 2 0 exists $extra->{'password'} ? :
0 2 exists $extra->{'real_pass'} ? :
488 0 0 unless defined $pass or $data->error
491 0 21 if $data->error
496 0 21 if ($meth = $self->{'verify_password'}) { }
497 0 0 unless (&$meth($self, $pass, $data))
498 0 0 unless $data->error
501 4 17 unless ($self->verify_password($pass, $data))
502 0 4 unless $data->error
505 4 17 if $data->error
509 0 17 if ($meth = $self->{'verify_payload'}) { }
510 0 0 unless (&$meth($self, $data->{'payload'}, $data))
511 0 0 unless $data->error
514 0 17 unless ($self->verify_payload($data->{'payload'}, $data))
515 0 0 unless $data->error
533 5 0 $self->use_base64 ? :
0 3 ($bkey = $self->use_blowfish) ? :
5 3 $armor eq 'base64' ? :
16 8 $armor eq 'none' ? :
536 0 21 if ($self->complex_plaintext and $copy =~ m[^ ([^/]+) / (\d+) / (-?\d+) / ([^/]*) / (.*) $]x) { }
2 19 elsif ($copy =~ m[^ ([^/]+) / (\d+) / (-?\d+) / ([^/]*) / ([a-fA-F0-9]{32}) (?: / (sh\.\d+\.\d+))? $]x) { }
11 8 elsif ($copy =~ m[^ ([^/]+) / (.*) $]x) { }
577 2 19 if ($data->{'secure_hash'}) { }
0 19 elsif ($data->{'cram_time'}) { }
0 19 elsif ($data->{'plain_time'} and $data->{'expires_min'} > 0 and $self->server_time - $data->{'plain_time'} > $data->{'expires_min'} * 60) { }
2 17 elsif ($pass =~ m[^([./0-9A-Za-z]{2})([./0-9A-Za-z]{11})$] and crypt($data->{'test_pass'}, $1) eq $pass) { }
0 17 elsif ($self->use_crypt) { }
580 0 2 if (not $array) { }
0 2 elsif (not @$array) { }
0 2 elsif (not $data->{'secure_hash'} =~ /^sh\.(\d+)\.(\d+)$/ or $1 > $#$array) { }
589 0 2 $pass =~ /^[a-fA-F0-9]{32}$/ ? :
592 0 2 if ($data->{'expires_min'} > 0 and $self->server_time - $data->{'cram_time'} > $data->{'expires_min'} * 60) { }
0 2 elsif (lc $data->{'test_pass'} ne $sum) { }
603 0 0 if $self->disable_simple_cram
604 0 0 $pass =~ /^[a-fA-F0-9]{32}$/ ? :
607 0 0 if ($data->{'expires_min'} > 0 and $self->server_time - $data->{'cram_time'} > $data->{'expires_min'} * 60) { }
0 0 elsif (lc $data->{'test_pass'} ne $sum) { }
628 0 0 $data->{'test_pass'} =~ /^[a-fA-F0-9]{32}$/ ? :
634 0 17 $is_md5_t ? :
635 0 17 $is_md5_r ? :
636 0 17 $is_md5_r ? :
0 17 $is_md5_t ? :
637 4 13 if $test ne $real
641 4 17 if $err
650 0 17 unless $data
651 0 17 if $data->{'user'} =~ m[/]
653 2 15 defined $data->{'expires_min'} ? :
657 0 17 if $user =~ m[/]
658 0 17 if $load =~ m[/]
661 0 17 defined $data->{'use_plaintext'} ? :
5 12 if (defined $data->{'use_plaintext'} ? $data->{'use_plaintext'} : $self->use_plaintext or defined $data->{'use_crypt'} and $data->{'use_crypt'} or defined $data->{'type'} and $data->{'type'} eq 'crypt') { }
664 5 0 defined $data->{'test_pass'} ? :
665 0 5 $self->complex_plaintext ? :
669 0 12 $data->{'real_pass'} =~ /^[a-fA-F0-9]{32}$/ ? :
12 0 defined $data->{'real_pass'} ? :
672 9 3 if (not $data->{'prefer_simple_cram'} and $array = eval { do { $self->secure_hash_keys } } and @$array) { }
681 0 3 if $self->disable_simple_cram
688 1 16 defined $data->{'use_base64'} ? :
0 17 if (my $key = $data->{'use_blowfish'} || $self->use_blowfish) { }
17 0 elsif (defined $data->{'use_base64'} ? $data->{'use_base64'} : $self->use_base64) { }
701 0 17 if (my $meth = $self->{'generate_payload'})
704 2 15 defined $args->{'payload'} ? :
710 3 18 if (my $meth = $self->{'verify_user'})
719 3 21 if (my $meth = $self->{'cleanup_user'})
727 0 2 unless defined $form_user and defined $cookie_user
734 3 0 if (my $meth = $self->{'get_pass_by_user'})
743 0 17 if (my $meth = $self->{'verify_payload'})
782 8 0 if $self->{'login_template'}
785 0 0 $_ ? :
0 0 /\[%/ ? :
0 0 ref $_ ? :
790 0 0 unless +(shift())->{'login_header'}
791 0 0 unless +(shift())->{'login_footer'}
795 0 0 if defined $self->{'login_form'}
829 0 13 defined $self->{'text_user'} ? :
830 0 13 defined $self->{'text_pass'} ? :
831 0 13 defined $self->{'text_save'} ? :
832 0 13 defined $self->{'hide_save'} ? :
833 0 13 defined $self->{'text_submit'} ? :
837 0 0 if defined $self->{'login_script'}
838 0 0 if $self->use_plaintext or $self->disable_simple_cram
878 0 24 unless $args
883 44 21 @_ == 1 ? :
889 7 218 if (@_ == 1)
898 0 0 $self->error || $self->{'user'} && $self->{'type'} ? :