Branch Coverage

blib/lib/Bot/Cobalt/Plugin/Auth.pm
Criterion Covered Total %
branch 0 194 0.0


line true false branch
90 0 0 unless ($alist)
140 0 0 unless (ref $superusers and &reftype($superusers) eq 'HASH')
149 0 0 unless (ref $su{$context} and &reftype($su{$context}) eq 'HASH')
155 0 0 unless (ref $su{$context}{$user} and &reftype($su{$context}{$user}) eq 'HASH')
169 0 0 ref $su{$context}{$user}{'Flags'} && &reftype($su{$context}{$user}{'Flags'}) eq 'HASH' ? :
181 0 0 if (exists $su{$context}{$user}{'Masks'} and not exists $su{$context}{$user}{'Mask'})
189 0 0 if (ref $su{$context}{$user}{'Mask'}) { }
190 0 0 unless (&reftype($su{$context}{$user}{'Mask'}) eq 'ARRAY')
325 0 0 if ($self->can($method))
330 0 0 if (defined $resp)
352 0 0 unless (defined $l_user and defined $l_pass)
390 0 0 unless defined $rpl
396 0 0 if defined $resp
410 0 0 unless (defined $auth_for_nick)
418 0 0 unless (defined $passwd_old and defined $passwd_new)
424 0 0 if ($user_rec->{'Flags'}{'SUPERUSER'})
429 0 0 unless (&passwdcmp($passwd_old, $stored_pass))
440 0 0 unless ($self->_write_access_list)
485 0 0 unless ($cmd)
492 0 0 unless ($auth_lev)
499 0 0 if ($self->can($method))
518 0 0 unless ($user_rec = $self->_get_user_rec($context, $username))
535 0 0 unless ($irc->nick_channels($nick))
552 0 0 if matches_mask($mask, $host)
555 0 0 unless (@matched_masks)
567 0 0 unless (&passwdcmp($passwd, $user_rec->{'Password'}))
613 0 0 unless ($auth_usr)
625 0 0 unless ($auth_lev >= $required_base_lev)
642 0 0 unless ($target_usr and $target_lev and $mask and $passwd)
648 0 0 unless ($target_lev =~ /^\d+$/)
652 0 0 if (exists $self->AccessList->{'-ALL'}{$target_usr})
663 0 0 if (exists $self->AccessList->{$context}{$target_usr})
674 0 0 unless ($target_lev < $auth_lev)
700 0 0 unless ($self->_write_access_list)
724 0 0 unless ($auth_usr)
735 0 0 unless ($auth_lev >= $required_base_lev)
748 0 0 unless ($target_usr)
756 0 0 unless (exists $this_alist->{$target_usr})
766 0 0 unless ($target_lev < $auth_lev)
788 0 0 unless $this_username eq $target_usr
793 0 0 unless ($self->_write_access_list)
814 0 0 unless $auth_lev
826 0 0 if (length $respstr > 250)
836 0 0 if $respstr
846 0 0 unless $auth_lev
851 0 0 if (my $target_lev = core()->auth->level($context, $target_nick)) { }
867 0 0 unless ($auth_lev)
872 0 0 unless (defined $target_usr)
879 0 0 unless ($user_rec = $self->_get_user_rec($context, $target_usr))
902 0 0 if (length $flag_repl > 300 or not @flags)
913 0 0 if (length $mask_repl > 300 or not @masks)
949 0 0 unless ($target_usr and @flags)
954 0 0 unless ($alist_ref = $self->_get_user_rec($context, $target_usr))
965 0 0 unless ($auth_lev >= $req_lev and $auth_lev > $target_usr_lev || $auth_usr eq $target_usr || $auth_flags->{'SUPERUSER'})
985 0 0 unless ($first and $this_flag)
989 0 0 if ($this_flag eq 'SUPERUSER')
993 0 0 if ($first eq '+') { }
0 0 elsif ($first eq '-') { }
1006 0 0 if ($self->_write_access_list) { }
1035 0 0 unless ($target_usr and $mask_specified)
1040 0 0 unless ($alist_ref = $self->_get_user_rec($context, $target_usr))
1054 0 0 unless ($auth_lev >= $req_lev and $auth_lev > $target_usr_lev || $auth_usr eq $target_usr || $flags->{'SUPERUSER'})
1071 0 0 unless ($oper and $host)
1078 0 0 if ($oper eq '+') { }
1080 0 0 unless grep {$_ eq $host;} @{$$alist_ref{'Masks'};}
1090 0 0 if (@masks == @{$alist_ref->{'Masks'};})
1103 0 0 if ($self->_write_access_list) { }
1120 0 0 unless (core()->auth->has_flag($context, $nick, 'SUPERUSER'))
1127 0 0 unless ($target_usr and $new_passwd)
1132 0 0 unless ($user_rec = $self->_get_user_rec($context, $target_usr))
1147 0 0 if ($self->_write_access_list) { }
1169 0 0 unless defined $context and defined $user
1174 0 0 unless exists $self->AccessList->{'-ALL'}{$user} or exists $self->AccessList->{$context} and exists $self->AccessList->{$context}{$user}
1178 0 0 exists $self->AccessList->{'-ALL'}{$user} ? :
1198 0 0 unless $authref = core()->auth->list($context)
1202 0 0 if ($nick) { }
1204 0 0 unless exists $authref->{$nick}
1206 0 0 unless ($self->_check_for_shared($context, $nick))
1213 0 0 if $self->_do_logout($context, $nick)
1220 0 0 unless ($self->_check_for_shared($context, $nick))
1221 0 0 if $self->_do_logout($context, $nick)
1246 0 0 @shared ? :
1266 0 0 unless core()->auth->alias($context, $nick) eq core()->get_plugin_alias($self)
1287 0 0 if (exists $auth_context->{$nick})
1291 0 0 if ($auth_pkg eq $current_pkg) { }
1320 0 0 unless $passwd
1336 0 0 if defined $dbpath
1344 0 0 if (defined $alist)
1345 0 0 unless ref $alist and &reftype($alist) eq 'HASH'
1362 0 0 unless $authdb
1365 0 0 unless (-f $authdb)
1386 0 0 unless $authdb
1387 0 0 unless $alist
1396 0 0 if ($cloned->{$context}{$user}{'Flags'}{'SUPERUSER'})
1404 0 0 unless keys %{$$cloned{$context};}
1408 0 0 unless keys %$cloned
1419 0 0 if &try(sub { $serializer->writefile($authdb, $cloned); my $p_cfg = &plugin_cfg($self); my $perms = oct($p_cfg->{'Opts'}{'AuthDB_Perms'} // '0600'); chmod $perms, $authdb; 1; } )