X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=lib%2FFile%2FKDBX%2FLoader%2FV3.pm;h=e65a5e761563b69e54290bc5c7cd28a42998fa4f;hb=4dc2a1996dfcf2dfda3c554daa2f5f59fa763494;hp=f7f951649169e92d99a9a3d6103ac3bbe89a6112;hpb=50f1a929d9224b9072b5fae39162a5d943323c5d;p=chaz%2Fp5-File-KDBX diff --git a/lib/File/KDBX/Loader/V3.pm b/lib/File/KDBX/Loader/V3.pm index f7f9516..e65a5e7 100644 --- a/lib/File/KDBX/Loader/V3.pm +++ b/lib/File/KDBX/Loader/V3.pm @@ -22,10 +22,10 @@ use File::KDBX::Constants qw(:header :compression :kdf); use File::KDBX::Error; use File::KDBX::IO::Crypt; use File::KDBX::IO::HashBlock; -use File::KDBX::Util qw(:io assert_64bit erase_scoped); +use File::KDBX::Util qw(:class :io :load assert_64bit erase_scoped); use namespace::clean; -use parent 'File::KDBX::Loader'; +extends 'File::KDBX::Loader'; our $VERSION = '999.999'; # VERSION @@ -42,7 +42,7 @@ sub _read_header { $buf .= $val; } - $type = KDBX_HEADER($type); + $type = to_header_constant($type); if ($type == HEADER_END) { # done } @@ -142,7 +142,7 @@ sub _read_body { my $compress = $kdbx->headers->{+HEADER_COMPRESSION_FLAGS}; if ($compress == COMPRESSION_GZIP) { - require IO::Uncompress::Gunzip; + load_optional('IO::Uncompress::Gunzip'); $fh = IO::Uncompress::Gunzip->new($fh) or throw "Failed to initialize compression library: $IO::Uncompress::Gunzip::GunzipError", error => $IO::Uncompress::Gunzip::GunzipError; @@ -152,6 +152,7 @@ sub _read_body { } $self->_read_inner_body($fh); + close($fh); if (my $header_hash = $kdbx->meta->{header_hash}) { my $got_header_hash = digest_data('SHA256', $header_data);