blib/lib/File/KeePass.pm | |||
---|---|---|---|
Criterion | Covered | Total | % |
condition | 137 | 452 | 30.3 |
line | l | !l | condition |
---|---|---|---|
840 | 0 | 0 | ref $cd eq 'HASH' and scalar keys %$cd |
line | !l | l&&!r | l&&r | condition |
---|---|---|---|---|
84 | 1 | 1 | 1 | not $$self{'keep_backup'} and -e $bak |
208 | 6 | 0 | 0 | not length $buffer and $$head{'n_groups'} |
263 | 0 | 0 | 0 | $$META{'header_hash'} and $$head{'raw'} |
0 | 0 | 0 | $$META{'header_hash'} and $$head{'raw'} and $$META{'header_hash'} ne $self->encode_base64(sha256($$head{'raw'})) | |
272 | 0 | 0 | 0 | $comp and $comp eq 'True' |
0 | 0 | 0 | $comp and $comp eq 'True' and length $content | |
360 | 0 | 0 | 0 | ref $val eq 'HASH' and $$val{'Protected'} |
0 | 0 | 0 | ref $val eq 'HASH' and $$val{'Protected'} and $$val{'Protected'} eq 'True' | |
362 | 0 | 0 | 0 | defined $val && length $val |
380 | 0 | 0 | 0 | $GROUPS[0] and $$node{'UUID'} |
0 | 0 | 0 | $GROUPS[0] and $$node{'UUID'} and $$node{'DeletionTime'} | |
391 | 0 | 0 | 0 | @GROUPS == 1 and $g |
0 | 0 | 0 | @GROUPS == 1 and $g and $$g{'notes'} | |
0 | 0 | 0 | @GROUPS == 1 and $g and $$g{'notes'} and $$g{'notes'} eq 'Added as a top group by File::KeePass' | |
0 | 0 | 0 | @GROUPS == 1 and $g and $$g{'notes'} and $$g{'notes'} eq 'Added as a top group by File::KeePass' and @{[] unless $$g{'groups'};} | |
0 | 0 | 0 | @GROUPS == 1 and $g and $$g{'notes'} and $$g{'notes'} eq 'Added as a top group by File::KeePass' and @{[] unless $$g{'groups'};} and not @{[] unless $$g{'entries'};} | |
0 | 0 | 0 | @GROUPS == 1 and $g and $$g{'notes'} and $$g{'notes'} eq 'Added as a top group by File::KeePass' and @{[] unless $$g{'groups'};} and not @{[] unless $$g{'entries'};} and not $$g{'auto_type_default'} | |
503 | 6 | 1 | 3 | $$entry{'comment'} and $$entry{'comment'} eq 'KPX_GROUP_TREE_STATE' |
541 | 2 | 6 | 2 | defined $bin and length $bin |
2 | 6 | 0 | defined $bname and length $bname | |
557 | 11 | 0 | 1 | defined $key and length $key |
11 | 0 | 0 | defined $win and length $win | |
592 | 0 | 0 | 0 | $date && $date =~ /$qr_date/ |
599 | 0 | 0 | 13 | defined $pass and length $pass |
609 | 0 | 13 | 0 | $$head{'version'} && $$head{'version'} eq '2' |
0 | 13 | 0 | $pass && $file | |
612 | 0 | 4 | 0 | $$head{'version'} && $$head{'version'} eq '2' |
640 | 0 | 9 | 0 | $reuse and $reuse < 0 |
655 | 4 | 3 | 0 | $$head{'sig2'} and $$head{'sig2'} eq 3041655655 |
656 | 0 | 0 | 0 | $$head{'seed_rand'} and length $$head{'seed_rand'} == 32 |
665 | 0 | 0 | 23 | /^\d+$/ && $_ < 4294967296 |
785 | 0 | 0 | 0 | $$head{'sig2'} and $$head{'sig2'} eq 3041655653 |
786 | 0 | 0 | 0 | $$head{'seed_rand'} and length $$head{'seed_rand'} == 16 |
797 | 0 | 0 | 0 | defined $_[0] && $_[0] eq '0' |
810 | 0 | 0 | 0 | $r and not $$META{$k} =~ /$r/ |
956 | 0 | 0 | 0 | @$groups and $$groups[0]{'deleted_objects'} |
1015 | 0 | 0 | 0 | defined $$head{'comment'} and length $$head{'comment'} |
1147 | 0 | 0 | 0 | $$force_array{$tag} and $$prev_ptr{$tag} ||= [] |
1193 | 0 | 0 | 0 | $xml and $indent |
1206 | 0 | 0 | 0 | defined $node && length $node |
1215 | 0 | 0 | 0 | defined $$node{'content'} and length $$node{'content'} |
1236 | 0 | 0 | 0 | $indent and not $$args{'no_trailing_newline'} |
1254 | 3 | 16 | 0 | defined $id and length $id |
1310 | 0 | 1 | 1 | defined $_[0]{$field} && $_[0]{$field} =~ /$$args{$key}/ |
1334 | 217 | 42 | 0 | @tests and grep {not &$_($g);} @tests |
1354 | 0 | 4 | 0 | $g and $c |
1401 | 14 | 29 | 0 | @tests and grep {not &$_($e);} @tests |
1421 | 0 | 1 | 0 | $e and $g |
line | l | !l | condition |
---|---|---|---|
48 | 2 | 1 | shift() || die("Missing file\n") |
49 | 1 | 1 | shift() || die("Missing pass\n") |
50 | 0 | 1 | shift() || {} |
59 | 0 | 4 | $head ||= {} |
103 | 0 | 0 | $args || {} |
225 | 0 | 0 | $buffer = eval { do { $self->decompress($buffer) } } or die "Failed to decompress document: $@" |
0 | 0 | $$head{'compression'} || '' | |
254 | 0 | 0 | delete $$node{'MemoryProtection'} || {} |
290 | 0 | 0 | delete $$node{'__entries__'} || [] |
0 | 0 | delete $$node{'__groups__'} || [] | |
326 | 0 | 0 | delete $$node{'AutoType'}{'__auto_type__'} || [] |
372 | 0 | 0 | delete $$node{'__entries__'} || [] |
429 | 21 | 0 | $$group{'created'} ||= '' |
432 | 13 | 8 | $$group{'level'} || 0 |
491 | 10 | 0 | $$entry{'created'} ||= '' |
542 | 4 | 0 | defined $_ or $_ = '' |
627 | 4 | 5 | $head ||= {} |
636 | 4 | 5 | $self->header || {} |
639 | 0 | 5 | $$head{'version'} || '1' |
690 | 4 | 19 | $$g{'icon'} || 0 |
14 | 9 | $$g{'level'} || 0 | |
705 | 5 | 8 | $$e{'binary'} || {} |
711 | 1 | 12 | $$e{'auto_type'} || [] |
724 | 0 | 13 | $$e{'icon'} || 0 |
759 | 7 | 0 | $$head{'n_groups'} ||= 0 |
760 | 5 | 2 | $$head{'n_entries'} ||= 0 |
831 | 0 | 0 | $$META{$_} || 0 |
833 | 0 | 0 | $$META{'MemoryProtection'} ||= {} |
839 | 0 | 0 | $$META{'CustomData'} ||= {} |
857 | 0 | 0 | $$e{'icon'} || 0 |
0 | 0 | $$e{'usage_count'} || 0 | |
0 | 0 | $$e{'custom_icon_uuid'} || 0 | |
888 | 0 | 0 | $$META{'MemoryProtection'}{"Protect$key"} || '' |
900 | 0 | 0 | $$e{'binary'} || {} |
916 | 0 | 0 | $$E{'History'}{'Entry'} ||= [] |
923 | 0 | 0 | $$group{'title'} || '' |
0 | 0 | $$group{'icon'} || 0 | |
0 | 0 | $$group{'usage_count'} || 0 | |
0 | 0 | $$group{'last_top_entry'} || 0 | |
948 | 0 | 0 | $$G{'Entry'} ||= [] |
951 | 0 | 0 | $$G{'Group'} ||= [] |
1006 | 0 | 0 | $$head{'0'} ||= "\r\n\r\n" |
1034 | 1 | 0 | -s $file || die("File $file appears to be empty.\n") |
1058 | 13 | 0 | 16 - length($buffer) % 16 || 16 |
1137 | 0 | 0 | $$args{'force_array'} || {} |
1138 | 0 | 0 | $$args{'start_handlers'} || {} |
1139 | 0 | 0 | $$args{'end_handlers'} || $$args{'handlers'} || {} |
1147 | 0 | 0 | $$prev_ptr{$tag} ||= [] |
1154 | 0 | 0 | $$prev_ptr{$tag} ||= {} |
1191 | 0 | 0 | $$args{'top'} || 'root' |
1192 | 0 | 0 | $$args{'declaration'} || '' |
1199 | 0 | 0 | delete $$ref{'__sort__'} || $$args{'sort'}{$tag} || [sort(grep({$_ ne '__attr__';} keys %$ref))] |
1289 | 5 | 6 | $$parent_group{'groups'} ||= [] |
1325 | 105 | 154 | $level || 0 |
1327 | 60 | 199 | $$g{'icon'} ||= 0 |
1367 | 4 | 2 | eval { do { $self->groups } } || [] |
1372 | 0 | 0 | $self->find_group({'id', $group}, $groups) || die("Could not find a matching group to add entry to.\n") |
1388 | 2 | 4 | $$group{'entries'} ||= [] |
1482 | 1 | 1 | $locker{"$groups"} || die("Passwords are not locked\n") |
1512 | 0 | 0 | $rounds ||= 20 |
line | l | !l&&r | !l&&!r | condition |
---|---|---|---|---|
37 | 2 | 5 | 2 | !exists($$self{'auto_lock'}) || $$self{'auto_lock'} |
60 | 0 | 0 | 0 | $$head{'version'} || $$self{'version'} |
78 | 1 | 0 | 0 | unlink $bak or unlink $tmp |
81 | 2 | 0 | 0 | rename $file, $bak or unlink $tmp |
208 | 0 | 0 | 6 | length $buffer > 4294967295 or not length $buffer and $$head{'n_groups'} |
226 | 0 | 0 | 0 | $$self{'keep_xml'} or $$head{'keep_xml'} |
504 | 0 | 0 | 3 | not defined $$entry{'binary'} or length $$entry{'binary'} < 4 |
541 | 2 | 0 | 8 | defined $bin and length $bin or defined $bname and length $bname |
557 | 1 | 0 | 11 | defined $key and length $key or defined $win and length $win |
609 | 13 | 0 | 0 | $pass || $file |
611 | 9 | 4 | 0 | $$head{'enc_iv'} ||= join('', map({chr rand 256;} 1..16)) |
612 | 9 | 4 | 0 | $$head{'seed_rand'} ||= join('', map({chr rand 256;} 1 .. ($$head{'version'} && $$head{'version'} eq '2' ? 32 : 16))) |
613 | 9 | 4 | 0 | $$head{'seed_key'} ||= sha256(time . rand(4294967295) . $$) |
614 | 0 | 0 | 4 | $$self{'rounds'} || ($$head{'version'} && $$head{'version'} eq '2' ? 6000 : 50000) |
9 | 4 | 0 | $$head{'rounds'} ||= $$self{'rounds'} || ($$head{'version'} && $$head{'version'} eq '2' ? 6000 : 50000) | |
628 | 0 | 9 | 0 | $groups ||= $self->groups |
630 | 4 | 0 | 5 | $$head{'version'} || $$self{'version'} |
631 | 0 | 0 | 9 | $$head{'reuse_header'} || !exists($$head{'reuse_header'}) && ($$self{'reuse_header'} || !exists($$self{'reuse_header'})) |
639 | 4 | 5 | 0 | $v ||= $$head{'version'} || '1' |
664 | 21 | 23 | 0 | $gid{$gid} ||= do { $_ = /^\d+$/ && $_ < 4294967296 ? $_ : (/^([a-f0-9]{16})/i ? hex $1 : int rand 4294967296); $_ = int rand 4294967296 while $gid{"\e$_\e"}++; $_ } |
677 | 2 | 2 | 0 | ($self->find_entries({'title', 'Meta-Info', 'username', 'SYSTEM', 'comment', 'KPX_GROUP_TREE_STATE', 'url', '$'}))[0] || $self->add_entry({'comment', 'KPX_GROUP_TREE_STATE', 'title', 'Meta-Info', 'username', 'SYSTEM', 'url', '$', 'id', '0000000000000000', 'group', $g[0], 'binary', {'bin-stream', $bin}}) |
690 | 23 | 0 | 0 | $$g{'created'} || $self->now |
23 | 0 | 0 | $$g{'modified'} || $self->now | |
23 | 0 | 0 | $$g{'accessed'} || $self->now | |
23 | 0 | 0 | $$g{'expires'} || $self->default_exp | |
724 | 13 | 0 | 0 | $$e{'created'} || $self->now |
13 | 0 | 0 | $$e{'modified'} || $self->now | |
13 | 0 | 0 | $$e{'accessed'} || $self->now | |
13 | 0 | 0 | $$e{'expires'} || $self->default_exp | |
789 | 0 | 0 | 0 | $$head{'start_bytes'} ||= join('', map({chr rand 256;} 1..32)) |
790 | 0 | 0 | 0 | $$head{'protected_stream_key'} ||= join('', map({chr rand 256;} 1..32)) |
795 | 0 | 0 | 0 | defined $_[0] || $_[1] |
810 | 0 | 0 | 0 | not defined $$META{$k} or $r and not $$META{$k} =~ /$r/ |
857 | 0 | 0 | 0 | $$e{'expires'} || $self->default_exp |
888 | 0 | 0 | 0 | ($$META{'MemoryProtection'}{"Protect$key"} || '') eq 'True' or $$e{'protected'}{$key =~ /^(Password|UserName|URL|Notes|Title)$/ ? lc $key : $key} |
908 | 0 | 0 | 0 | length $$b{'content'} < 100 || $$self{'no_binary_compress'} |
923 | 0 | 0 | 0 | $$group{'expires'} || $self->default_exp |
982 | 0 | 0 | 0 | $$self{'keep_xml'} or $$head{'keep_xml'} |
994 | 0 | 0 | 0 | not $date or $date =~ /^\d+$/ |
1005 | 0 | 0 | 0 | !defined($$head{'compression'}) || $$head{'compression'} eq '1' |
1007 | 0 | 0 | 0 | $$head{'protected_stream_key'} ||= join('', map({chr rand 256;} 1..32)) |
1147 | 0 | 0 | 0 | exists $$prev_ptr{$tag} or $$force_array{$tag} and $$prev_ptr{$tag} ||= [] |
1148 | 0 | 0 | 0 | $ptr or $data |
1157 | 0 | 0 | 0 | $$s_handlers{$tag} || $$s_handlers{'__any__'} |
1179 | 0 | 0 | 0 | $$e_handlers{$tag} || $$e_handlers{'__any__'} |
1209 | 0 | 0 | 0 | $$node{'__attr__'} or exists $$node{'content'} |
1255 | 0 | 19 | 0 | $$uniq{$id} ||= do { if (length $id != 16) { $id = substr($self->encode_base64($id), 0, 16) if not $id =~ /^\d+$/ or $id > 4294967295; $id = sprintf('%016s', $id) if $id ne '0'; }; $id = $self->gen_uuid while $$uniq{$id}++; $id } |
1257 | 0 | 0 | 0 | not $id =~ /^\d+$/ or $id > 4294967295 |
1291 | 0 | 0 | 10 | $top_groups || ($$self{'groups'} ||= []) |
11 | 10 | 0 | $groups ||= $top_groups || ($$self{'groups'} ||= []) | |
1294 | 0 | 21 | 0 | $$args{'expires'} ||= $self->default_exp |
1313 | 52 | 4 | 11 | !$op || $op eq '=' |
1323 | 162 | 45 | 0 | $groups || $self->groups |
1331 | 21 | 0 | 259 | not defined $$g{'id'} or $uniq{$$g{'id'}}++ |
1367 | 0 | 6 | 0 | $groups ||= eval { do { $self->groups } } || [] |
1370 | 4 | 2 | 0 | delete $$args{'group'} || $$groups[0] || $self->add_group({}) |
1383 | 1 | 5 | 0 | $$args{'expires'} ||= $self->default_exp |
1432 | 0 | 80 | 0 | $time || time |
1442 | 13 | 4 | 0 | shift() || $self->groups |
1448 | 0 | 5 | 0 | shift() || $self->groups |
1465 | 0 | 13 | 0 | shift() || $self->groups |
1481 | 0 | 2 | 0 | shift() || $self->groups |