Branch Coverage

blib/lib/CGI/AuthRegister.pm
Criterion Covered Total %
branch 1 496 0.2


line true false branch
83 0 0 if (-r "configuration.pl")
92 0 0 if ($ENV{'HTTPS'} ne "on")
110 0 0 if ($querystring eq "" and param("querystring"))
112 0 0 if ($querystring eq "cas-all.css")
113 0 0 if ($querystring eq "cas-mobile.css")
115 0 0 if (param("rt") ne "" and param("rt") eq "verify")
119 0 0 if ($r ne "" and $r->{'stoken'} eq $stoken and $r->{'userid'} eq $username)
121 0 0 if ($CGI::AuthRegister::DebugLevel > 5)
124 0 0 if ($ans ne "ok")
126 0 0 if ($CGI::AuthRegister::DebugLevel > 5)
134 0 0 if (param('redirect_uri') ne '') { }
0 0 elsif (param('r') ne '') { }
141 0 0 if ($redirect_uri ne "")
155 0 0 if ($redirect_uri ne "")
162 0 0 if ($redirect_uri ne '') { }
165 0 0 unless (-f $f or &check_db_files)
167 0 0 unless (-f $f)
169 0 0 if ($CGI::AuthRegister::Error ne "")
187 0 0 if ($redirect_uri ne "" and not $redirect_uri =~ m[^https://(\w|[-.~/])+]i and not $redirect_uri =~ m[^http://(\w|[-.~/:])+]i)
207 0 0 if ($querystring eq "forgotpwd" or param("rt") eq "forgotpwd")
208 0 0 if ($CGI::AuthRegister::LinkForgotpwd)
236 0 0 if ($CGI::AuthRegister::SessionId ne "" and param("keywords") eq "logout")
239 0 0 if ($CGI::AuthRegister::SessionId ne "")
243 0 0 if ($Request_type eq 'Login') { }
0 0 elsif ($Request_type eq 'Send_Password') { }
248 0 0 if (not &login($username, $password)) { }
251 0 0 if ($redirect_uri ne "")
287 0 0 if exists $args{'-cas'}
292 0 0 $a =~ /password/i ? :
300 0 0 $CGI::AuthRegister::AllowSignup ? :
318 0 0 if ($CGI::AuthRegister::SessionId ne "" and param("keywords") eq "logout")
322 0 0 if ($CGI::AuthRegister::SessionId ne "")
324 0 0 if (param('keywords') eq 'signup' and $CGI::AuthRegister::AllowSignup) { }
0 0 elsif (param('confirmation_code')) { }
334 0 0 if ($Request_type eq 'Login') { }
0 0 elsif ($Request_type eq 'Send_Password') { }
0 0 elsif ($Request_type eq 'Reset_Password') { }
0 0 elsif ($Request_type eq 'Register' and $CGI::AuthRegister::AllowSignup) { }
338 0 0 if (not &login($email, $password)) { }
382 0 0 if exists $args{'-return_status'}
390 0 0 if ($CGI::AuthRegister::SessionId ne "" and param("keywords") eq "logout")
392 0 0 if ($retStatus)
395 0 0 if ($args{'-logout_redirect'})
399 0 0 if $args{'-logout_title'}
402 0 0 if ($redirect) { }
407 0 0 if ($CGI::AuthRegister::SessionId ne "")
409 0 0 if ($header_no_print)
413 0 0 if ($request_type ne "Proceed")
414 0 0 if ($retStatus)
418 0 0 if ($username eq "" or $stoken eq "")
419 0 0 if ($retStatus)
422 0 0 unless ($casurl =~ m[^https://]i)
431 0 0 if ($resp->is_success) { }
433 0 0 if ($message eq 'answer:ok') { }
439 0 0 if ($result ne "ok")
442 0 0 if ($retStatus)
444 0 0 $CGI::AuthRegister::AddAuthenticatedUser ? :
446 0 0 if ($u eq "")
449 0 0 if ($retStatus)
461 0 0 if (exists $args{'-redirect'} and $args{'-redirect'} ne "" and $args{'-redirect'} ne $ENV{'SCRIPT_NAME'})
464 0 0 if (exists $args{'-back'} and $args{'-back'})
468 0 0 if ($CGI::AuthRegister::SessionId eq "")
469 0 0 if ($ENV{'SCRIPT_NAME'} eq $defaultcgi)
480 0 0 if ($redirect ne '') { }
481 0 0 if ($CGI::AuthRegister::SessionId eq '') { }
488 0 0 if ($CGI::AuthRegister::SessionId eq '') { }
505 0 0 if ($CGI::AuthRegister::DebugLevel > 5)
506 0 0 if ($c eq "")
508 0 0 unless ($CGI::AuthRegister::SessionId =~ /^[\w.:-]+$/ and $CGI::AuthRegister::Ticket =~ /^\w+$/)
513 0 0 unless (-f $sessioninfofile)
515 0 0 if (not ref $se or $CGI::AuthRegister::Ticket ne $se->{'Ticket'})
519 0 0 if ($CGI::AuthRegister::UserEmail =~ /@/) { }
0 0 elsif ($CGI::AuthRegister::UserId ne '') { }
522 0 0 if ($CGI::AuthRegister::UserId ne "" and $CGI::AuthRegister::User->{'userid'} ne $CGI::AuthRegister::UserId)
524 0 0 if ($CGI::AuthRegister::Error ne "")
527 0 0 if ($CGI::AuthRegister::Error ne "")
538 0 0 unless ($reg_userid =~ /^(\w|[.-])+$/)
541 0 0 unless (&emailcheckok($reg_email))
542 0 0 if ($reg_password eq "")
543 0 0 if ($reg_password ne $reg_password2)
547 0 0 unless (-f $dbf or &check_db_files)
548 0 0 unless (&lock_mkdir($dbf))
550 0 0 if (ref $db_ref ne "ARRAY")
557 0 0 if ($u->{'userid'} eq $reg_userid)
558 0 0 if ($u->{'email'} eq $reg_email)
566 0 0 if ($CGI::AuthRegister::Error)
582 0 0 unless (-f $dbf or &check_db_files)
583 0 0 unless (&lock_mkdir($dbf))
585 0 0 if (ref $db_ref ne "ARRAY")
589 0 0 if (defined $u->{'status'} and $u->{'status'} =~ /^disabled, waiting for confirmation code (\S+)/ and $1 eq $confirmation_code)
595 0 0 unless ($flag)
608 0 0 if $pwstore eq ""
610 0 0 unless (-f $pwdf)
611 0 0 unless (&lock_mkdir($pwdf))
612 0 0 unless open PH, $pwdf
616 0 0 if $e ne $email
620 0 0 if ($pwstore eq 'raw') { }
0 0 elsif ($pwstore eq 'md5') { }
631 0 0 if $pwstoretype eq ""
633 0 0 unless (&check_db_files)
634 0 0 unless (&lock_mkdir($pwdf))
635 0 0 unless open PH, $pwdf
637 0 0 if ($pwstoretype eq 'md5') { }
642 0 0 if ($e eq $email) { }
654 0 0 unless $n > 0
662 0 0 if ($CGI::AuthRegister::Session eq "")
663 0 0 if (not -d "$CGI::AuthRegister::DBdir/$CGI::AuthRegister::DBsessions/$CGI::AuthRegister::SessionId") { }
676 0 0 unless ($email =~ /@/)
677 0 0 if ($email ne '') { }
678 0 0 unless (&emailcheckok($email))
682 0 0 if ($u eq "")
686 0 0 if ($userid eq "")
687 0 0 if ($CGI::AuthRegister::LDAPuse and $CGI::AuthRegister::LDAPaddUsers)
690 0 0 if ($u eq "")
697 0 0 unless (password_check($CGI::AuthRegister::User, $password))
707 0 0 unless (&password_check_ldap($userid, $password))
710 0 0 if ($u eq "")
723 0 0 unless ($email =~ /@/ or $userid =~ /\w/)
726 0 0 unless (-d $sDir or &check_db_files)
732 0 0 unless (mkdir "$sDir/$sessionid", 448)
734 0 0 if $cnt == 100
739 0 0 if $email ne ""
740 0 0 if $userid ne ""
745 0 0 unless ref $CGI::AuthRegister::Session
752 0 0 if (defined $u->{'status'} and $u->{'status'} =~ /^\s*disabled\b/)
754 0 0 if ($CGI::AuthRegister::LDAPuse)
756 0 0 if ($pwstored =~ /^raw:/)
757 0 0 $pwstored eq $password ? :
758 0 0 if ($pwstored =~ /^md5:/)
759 0 0 $pwstored eq md5_base64($password) ? :
767 0 0 if ($username eq "" or $CGI::AuthRegister::LDAPserver eq "" or $CGI::AuthRegister::LDAPdn eq "")
770 0 0 if ($@)
773 0 0 unless my $ldap = "Net::LDAP"->new("ldaps://$CGI::AuthRegister::LDAPserver")
775 0 0 if ($mesg->code == 0)
789 0 0 unless (-f $pwfile or &check_db_files)
790 0 0 unless (&lock_mkdir($pwfile))
791 0 0 unless (open PH, $pwfile)
795 0 0 if ($e eq $email)
805 0 0 unless $n > 0
814 1 0 unless $n > 0
820 0 0 if ($#_ >= -1)
821 0 0 if $CGI::AuthRegister::LogReport eq ""
822 0 0 if ($CGI::AuthRegister::SendLogs)
833 0 0 if ($email eq "")
835 0 0 unless (emailcheckok($email))
838 0 0 if ($user eq "")
849 0 0 if ($email eq "")
852 0 0 if ($email =~ /@/) { }
854 0 0 if ($user eq "")
857 0 0 unless (emailcheckok($email))
860 0 0 if ($pw =~ /^raw:/) { }
0 0 elsif ($pw ne '') { }
884 0 0 if $CGI::AuthRegister::Email_bcc eq ""
886 0 0 unless $CGI::AuthRegister::Email_from eq ""
893 0 0 unless &emailcheckok($email)
895 0 0 unless ($subject =~ /^Subject: /)
899 0 0 unless $CGI::AuthRegister::Email_from eq ""
901 0 0 unless $CGI::AuthRegister::Email_bcc eq ""
908 0 0 unless (-x $CGI::AuthRegister::Sendmail)
911 0 0 unless (open S, "|$CGI::AuthRegister::Sendmail -ti")
943 0 0 if ($email =~ /^[a-zA-Z][\w\.+-]*[a-zA-Z0-9+-]@ [a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/x)
950 0 0 if $userid =~ /^[a-zA-Z0-9-]+$/
956 0 0 unless (-f $f)
961 0 0 unless $k =~ /^k=/
963 0 0 if (ref $db_ref ne "ARRAY")
967 0 0 if (exists $r->{$k} and $v eq $r->{$k})
974 0 0 if (ref $db_ref ne "ARRAY")
980 0 0 if (exists $r->{$k} and $v eq $r->{$k})
987 0 0 if (ref $db_ref ne "ARRAY")
991 0 0 if (lc $email eq lc $r->{'email'})
1000 0 0 unless (-f $f or &check_db_files)
1004 0 0 unless exists $r->{'userid'}
1006 0 0 unless $v1 eq $userid
1007 0 0 if ($u eq "")
1010 0 0 unless $u eq ""
1019 0 0 unless (-f $f or &check_db_files)
1022 0 0 if ($k eq "" or $v eq "")
1026 0 0 unless exists $r->{$k}
1028 0 0 unless $v eq $v1
1029 0 0 if ($u eq "")
1032 0 0 unless $u eq ""
1038 0 0 unless (-d $CGI::AuthRegister::DBdir)
1039 0 0 unless ($ret)
1040 0 0 unless (-f $pwfile)
1041 0 0 unless (-f $pwfile)
1044 0 0 unless (-f $f)
1046 0 0 unless (-f $f)
1048 0 0 unless (-d $f)
1049 0 0 unless ($ret)
1060 0 0 if ($arg =~ /^file=/)
1061 0 0 if $file eq ""
1062 0 0 unless open F, $file
1070 0 0 if ($arg =~ /^(\s*\n|[ \t]*#.*\n)*/)
1072 0 0 if ($arg =~ /\n(\n+)/) { }
1074 0 0 if ($dbi > $#{$db;})
1078 0 0 if ($record =~ /^.*/)
1081 0 0 unless $record =~ /^([^\n:]*):(.*)\n/
1084 0 0 if (exists $r->{$k})
1090 0 0 if (exists $db->[$dbi]{$k} and $db->[$dbi]{$k} eq $v) { }
0 0 elsif (exists $db->[$dbi]{$k}) { }
1099 0 0 unless (exists $savedkeys{$k})
1116 0 0 if ($file ne '') { }
1117 0 0 if ($argcopy ne $arg_save)
1127 0 0 unless $kdel =~ /^k=/
1128 0 0 unless (&lock_mkdir($dbf))
1129 0 0 unless (open F, $dbf)
1136 0 0 if ($arg =~ /^([ \t\r]*(#.*)?\n)+/)
1138 0 0 if $arg eq ""
1139 0 0 if ($arg =~ /([ \t\r]*\n){2,}/) { }
1144 0 0 unless $record =~ /^[ \t]*([^\n:]*?)[ \t]*:/
1148 0 0 unless $record =~ /^[ \t]*(.*?)[ \t\r]*\n/
1150 0 0 if (exists $r->{$k})
1157 0 0 if (exists $r->{$kdel} and $r->{$kdel} eq $vdel) { }
1161 0 0 if ($argcopy ne $arg_save)
1162 0 0 unless (open F, ">$dbf.lock/new")
1172 0 0 if ($arg =~ /^file=/)
1173 0 0 unless (&lock_mkdir($f))
1175 0 0 unless (open F, $f)
1184 0 0 if ($arg =~ /\n\n+/) { }
1188 0 0 if ($record =~ /^#.*\n?/)
1191 0 0 unless $record =~ /^([^\n:]*):(.*)\n/
1193 0 0 if (exists $r->{$k})
1209 0 0 unless (&lock_mkdir($fdb))
1210 0 0 unless (open F, ">>$fdb")
1219 0 0 if ($arg =~ /^file=/)
1220 0 0 unless open F, $f
1226 0 0 if ($arg =~ /\n\n+/) { }
1232 0 0 unless $record =~ /^([^\n:]*):(.*)\n/
1234 0 0 if (exists $r->{$k})
1247 0 0 if $n < 1
1254 0 0 unless (open F, ">$f")
1260 0 0 unless (open F, "<$f")
1263 0 0 wantarray ? :
1274 0 0 if (not -e $lockd and $locked = mkdir($lockd, 448))
1279 0 0 unless -e $lockd
1280 0 0 if ($locked)
1289 0 0 unless (-e $lockd)
1290 0 0 if (-d $lockd)
1291 0 0 if (-f $lockd or -l $lockd)
1496 0 0 if ($CGI::AuthRegister::GenCasPageCustom ne "")
1504 0 0 if (param('redirect_uri') ne '') { }
0 0 elsif (param('r') ne '') { }
1513 0 0 if ($forgotpassword)
1515 0 0 if ($CGI::AuthRegister::SessionId ne "")
1520 0 0 if ($removerighthandside) { }
1532 0 0 if ($par eq 'cas-all.css') { }
0 0 elsif ($par eq 'cas-mobile.css') { }
2147 0 0 unless $CGI::AuthRegister::DebugLevel > 5