fixed issue#8, now using File::Temp

This commit is contained in:
git@daemon.de
2015-01-12 11:17:34 +01:00
parent c89d5c9645
commit 2bd22cfca6
10 changed files with 58 additions and 19 deletions

View File

@@ -1,3 +1,7 @@
1.15
fixed github#8, using File::Temp instead of self baked
File::Spec.
1.14 1.14
fixed github#7: added PasswordPolicy.pm to MANIFEST. fixed github#7: added PasswordPolicy.pm to MANIFEST.

View File

@@ -1,4 +1,5 @@
lib/Crypt/PWSafe3/Databaseformat.pm lib/Crypt/PWSafe3/Databaseformat.pm
lib/Crypt/PWSafe3/PasswordPolicy.pm
lib/Crypt/PWSafe3/Field.pm lib/Crypt/PWSafe3/Field.pm
lib/Crypt/PWSafe3/HeaderField.pm lib/Crypt/PWSafe3/HeaderField.pm
lib/Crypt/PWSafe3/Record.pm lib/Crypt/PWSafe3/Record.pm

View File

@@ -1,3 +1,9 @@
#
# Copyright (c) 2011-2015 T.Linden <tlinden |AT| cpan.org>.
# All Rights Reserved. Std. disclaimer applies.
# Artistic License, same as perl itself. Have fun.
#
require 5.004; require 5.004;
use ExtUtils::MakeMaker; use ExtUtils::MakeMaker;
@@ -24,6 +30,7 @@ WriteMakefile(
'Crypt::Random' => 1.25, 'Crypt::Random' => 1.25,
'Data::UUID' => 1.217, 'Data::UUID' => 1.217,
'Shell' => 0.5, 'Shell' => 0.5,
'File::Temp' => 0,
}, },
'AUTHOR' => 'Thomas Linden <tlinden@cpan.org>', 'AUTHOR' => 'Thomas Linden <tlinden@cpan.org>',
'clean' => { 'clean' => {

2
README
View File

@@ -49,5 +49,5 @@ AUTHOR
VERSION VERSION
1.07 1.15

View File

@@ -1,4 +1,9 @@
#
# Copyright (c) 2011-2015 T.Linden <tlinden |AT| cpan.org>.
# All Rights Reserved. Std. disclaimer applies.
# Artistic License, same as perl itself. Have fun.
#
# Implements:
# http://passwordsafe.svn.sourceforge.net/viewvc/passwordsafe/trunk/pwsafe/pwsafe/docs/formatV3.txt?revision=2139 # http://passwordsafe.svn.sourceforge.net/viewvc/passwordsafe/trunk/pwsafe/pwsafe/docs/formatV3.txt?revision=2139
package Crypt::PWSafe3; package Crypt::PWSafe3;
@@ -16,13 +21,14 @@ use Digest::SHA;
use Crypt::Random qw( makerandom ); use Crypt::Random qw( makerandom );
use Data::UUID; use Data::UUID;
use File::Copy qw(copy move); use File::Copy qw(copy move);
use File::Spec; #use File::Spec;
use File::Temp;
use FileHandle; use FileHandle;
use Data::Dumper; use Data::Dumper;
use Exporter (); use Exporter ();
use vars qw(@ISA @EXPORT); use vars qw(@ISA @EXPORT);
$Crypt::PWSafe3::VERSION = '1.14'; $Crypt::PWSafe3::VERSION = '1.15';
use Crypt::PWSafe3::Field; use Crypt::PWSafe3::Field;
use Crypt::PWSafe3::HeaderField; use Crypt::PWSafe3::HeaderField;
@@ -33,11 +39,11 @@ use Crypt::PWSafe3::PasswordPolicy;
require 5.10.0; require 5.10.0;
# #
# check, which random source to use. # check which random source to use.
# install a wrapper closure around the # install a wrapper closure around the
# one we found. # one we found.
BEGIN { BEGIN {
eval { eval {
require Bytes::Random::Secure; require Bytes::Random::Secure;
Bytes::Random::Secure->import("random_bytes"); Bytes::Random::Secure->import("random_bytes");
}; };
@@ -338,12 +344,9 @@ sub save {
$this->addheader($whatsaved); $this->addheader($whatsaved);
$this->addheader($whosaved); $this->addheader($whosaved);
my $tmpfile = $this->untaint(File::Spec->catfile(File::Spec->tmpdir(), my $fd = File::Temp->new(TEMPLATE => '.vaultXXXXXXXX', TMPDIR => 1) or croak "Could not open tmpfile: $!\n";
".vault-" . unpack("L<4", $this->random(16)))); my $tmpfile = "$fd";
unlink $tmpfile;
my $fd = new FileHandle($tmpfile, 'w') or croak "Could not open tmpfile $tmpfile: $!\n";
$fd->binmode();
$this->{fd} = $fd; $this->{fd} = $fd;
$this->writebytes($this->tag); $this->writebytes($this->tag);
@@ -956,7 +959,7 @@ in this module are his ideas ported to perl.
=head1 COPYRIGHT =head1 COPYRIGHT
Copyright (c) 2011-2013 by T.Linden <tlinden@cpan.org>. Copyright (c) 2011-2015 by T.Linden <tlinden@cpan.org>.
All rights reserved. All rights reserved.
=head1 LICENSE =head1 LICENSE
@@ -966,7 +969,7 @@ and/or modify it under the same terms as Perl itself.
=head1 VERSION =head1 VERSION
Crypt::PWSafe3 Version 1.11. Crypt::PWSafe3 Version 1.15.
=cut =cut

View File

@@ -1,3 +1,8 @@
#
# Copyright (c) 2011-2015 T.Linden <tlinden |AT| cpan.org>.
# All Rights Reserved. Std. disclaimer applies.
# Artistic License, same as perl itself. Have fun.
#
package Crypt::PWSafe3::Field; package Crypt::PWSafe3::Field;
@@ -170,7 +175,7 @@ T. Linden <tlinden@cpan.org>
=head1 COPYRIGHT =head1 COPYRIGHT
Copyright (c) 2011-2013 by T.Linden <tlinden@cpan.org>. Copyright (c) 2011-2015 by T.Linden <tlinden@cpan.org>.
All rights reserved. All rights reserved.
=head1 LICENSE =head1 LICENSE

View File

@@ -1,3 +1,8 @@
#
# Copyright (c) 2011-2015 T.Linden <tlinden |AT| cpan.org>.
# All Rights Reserved. Std. disclaimer applies.
# Artistic License, same as perl itself. Have fun.
#
package Crypt::PWSafe3::HeaderField; package Crypt::PWSafe3::HeaderField;
use Carp::Heavy; use Carp::Heavy;
@@ -195,7 +200,7 @@ T. Linden <tlinden@cpan.org>
=head1 COPYRIGHT =head1 COPYRIGHT
Copyright (c) 2011-2013 by T.Linden <tlinden@cpan.org>. Copyright (c) 2011-2015 by T.Linden <tlinden@cpan.org>.
All rights reserved. All rights reserved.
=head1 LICENSE =head1 LICENSE

View File

@@ -1,3 +1,8 @@
#
# Copyright (c) 2011-2015 T.Linden <tlinden |AT| cpan.org>.
# All Rights Reserved. Std. disclaimer applies.
# Artistic License, same as perl itself. Have fun.
#
package Crypt::PWSafe3::PasswordPolicy; package Crypt::PWSafe3::PasswordPolicy;
@@ -190,7 +195,7 @@ T. Linden <tlinden@cpan.org>
=head1 COPYRIGHT =head1 COPYRIGHT
Copyright (c) 2011-2013 by T.Linden <tlinden@cpan.org>. Copyright (c) 2011-2015 by T.Linden <tlinden@cpan.org>.
All rights reserved. All rights reserved.
=head1 LICENSE =head1 LICENSE

View File

@@ -1,3 +1,8 @@
#
# Copyright (c) 2011-2015 T.Linden <tlinden |AT| cpan.org>.
# All Rights Reserved. Std. disclaimer applies.
# Artistic License, same as perl itself. Have fun.
#
package Crypt::PWSafe3::Record; package Crypt::PWSafe3::Record;
use Carp::Heavy; use Carp::Heavy;
@@ -325,7 +330,7 @@ T. Linden <tlinden@cpan.org>
=head1 COPYRIGHT =head1 COPYRIGHT
Copyright (c) 2011-2013 by T.Linden <tlinden@cpan.org>. Copyright (c) 2011-2015 by T.Linden <tlinden@cpan.org>.
All rights reserved. All rights reserved.
=head1 LICENSE =head1 LICENSE

View File

@@ -1,4 +1,8 @@
# #
# Copyright (c) 2011-2015 T.Linden <tlinden |AT| cpan.org>.
# All Rights Reserved. Std. disclaimer applies.
# Artistic License, same as perl itself. Have fun.
#
# helper class to provide SHA-256 to HMAC class # helper class to provide SHA-256 to HMAC class
package Crypt::PWSafe3::SHA256; package Crypt::PWSafe3::SHA256;
@@ -44,7 +48,7 @@ L<Digest::HMAC>
=head1 COPYRIGHT =head1 COPYRIGHT
Copyright (c) 2011-2013 by T.Linden <tlinden@cpan.org>. Copyright (c) 2011-2015 by T.Linden <tlinden@cpan.org>.
All rights reserved. All rights reserved.
=head1 LICENSE =head1 LICENSE