diff --git a/CHANGELOG b/CHANGELOG index 4dbd66f..97bb0e2 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,7 @@ +1.15 + fixed github#8, using File::Temp instead of self baked + File::Spec. + 1.14 fixed github#7: added PasswordPolicy.pm to MANIFEST. diff --git a/MANIFEST b/MANIFEST index cdfa9e8..6eb9fed 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1,4 +1,5 @@ lib/Crypt/PWSafe3/Databaseformat.pm +lib/Crypt/PWSafe3/PasswordPolicy.pm lib/Crypt/PWSafe3/Field.pm lib/Crypt/PWSafe3/HeaderField.pm lib/Crypt/PWSafe3/Record.pm diff --git a/Makefile.PL b/Makefile.PL index ff2a31d..58cef58 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -1,3 +1,9 @@ +# +# Copyright (c) 2011-2015 T.Linden . +# All Rights Reserved. Std. disclaimer applies. +# Artistic License, same as perl itself. Have fun. +# + require 5.004; use ExtUtils::MakeMaker; @@ -24,6 +30,7 @@ WriteMakefile( 'Crypt::Random' => 1.25, 'Data::UUID' => 1.217, 'Shell' => 0.5, + 'File::Temp' => 0, }, 'AUTHOR' => 'Thomas Linden ', 'clean' => { diff --git a/README b/README index 61e3e08..3fcde00 100644 --- a/README +++ b/README @@ -49,5 +49,5 @@ AUTHOR VERSION - 1.07 + 1.15 diff --git a/lib/Crypt/PWSafe3.pm b/lib/Crypt/PWSafe3.pm index d44a7ca..944182a 100644 --- a/lib/Crypt/PWSafe3.pm +++ b/lib/Crypt/PWSafe3.pm @@ -1,4 +1,9 @@ - +# +# Copyright (c) 2011-2015 T.Linden . +# 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 package Crypt::PWSafe3; @@ -16,13 +21,14 @@ use Digest::SHA; use Crypt::Random qw( makerandom ); use Data::UUID; use File::Copy qw(copy move); -use File::Spec; +#use File::Spec; +use File::Temp; use FileHandle; use Data::Dumper; use Exporter (); use vars qw(@ISA @EXPORT); -$Crypt::PWSafe3::VERSION = '1.14'; +$Crypt::PWSafe3::VERSION = '1.15'; use Crypt::PWSafe3::Field; use Crypt::PWSafe3::HeaderField; @@ -33,11 +39,11 @@ use Crypt::PWSafe3::PasswordPolicy; require 5.10.0; # -# check, which random source to use. +# check which random source to use. # install a wrapper closure around the # one we found. BEGIN { - eval { + eval { require Bytes::Random::Secure; Bytes::Random::Secure->import("random_bytes"); }; @@ -338,12 +344,9 @@ sub save { $this->addheader($whatsaved); $this->addheader($whosaved); - my $tmpfile = $this->untaint(File::Spec->catfile(File::Spec->tmpdir(), - ".vault-" . unpack("L<4", $this->random(16)))); - - unlink $tmpfile; - my $fd = new FileHandle($tmpfile, 'w') or croak "Could not open tmpfile $tmpfile: $!\n"; - $fd->binmode(); + my $fd = File::Temp->new(TEMPLATE => '.vaultXXXXXXXX', TMPDIR => 1) or croak "Could not open tmpfile: $!\n"; + my $tmpfile = "$fd"; + $this->{fd} = $fd; $this->writebytes($this->tag); @@ -956,7 +959,7 @@ in this module are his ideas ported to perl. =head1 COPYRIGHT -Copyright (c) 2011-2013 by T.Linden . +Copyright (c) 2011-2015 by T.Linden . All rights reserved. =head1 LICENSE @@ -966,7 +969,7 @@ and/or modify it under the same terms as Perl itself. =head1 VERSION -Crypt::PWSafe3 Version 1.11. +Crypt::PWSafe3 Version 1.15. =cut diff --git a/lib/Crypt/PWSafe3/Field.pm b/lib/Crypt/PWSafe3/Field.pm index ccdcb77..7996d6e 100644 --- a/lib/Crypt/PWSafe3/Field.pm +++ b/lib/Crypt/PWSafe3/Field.pm @@ -1,3 +1,8 @@ +# +# Copyright (c) 2011-2015 T.Linden . +# All Rights Reserved. Std. disclaimer applies. +# Artistic License, same as perl itself. Have fun. +# package Crypt::PWSafe3::Field; @@ -170,7 +175,7 @@ T. Linden =head1 COPYRIGHT -Copyright (c) 2011-2013 by T.Linden . +Copyright (c) 2011-2015 by T.Linden . All rights reserved. =head1 LICENSE diff --git a/lib/Crypt/PWSafe3/HeaderField.pm b/lib/Crypt/PWSafe3/HeaderField.pm index 32bd715..8861b8f 100644 --- a/lib/Crypt/PWSafe3/HeaderField.pm +++ b/lib/Crypt/PWSafe3/HeaderField.pm @@ -1,3 +1,8 @@ +# +# Copyright (c) 2011-2015 T.Linden . +# All Rights Reserved. Std. disclaimer applies. +# Artistic License, same as perl itself. Have fun. +# package Crypt::PWSafe3::HeaderField; use Carp::Heavy; @@ -195,7 +200,7 @@ T. Linden =head1 COPYRIGHT -Copyright (c) 2011-2013 by T.Linden . +Copyright (c) 2011-2015 by T.Linden . All rights reserved. =head1 LICENSE diff --git a/lib/Crypt/PWSafe3/PasswordPolicy.pm b/lib/Crypt/PWSafe3/PasswordPolicy.pm index 6db1313..e5a066d 100644 --- a/lib/Crypt/PWSafe3/PasswordPolicy.pm +++ b/lib/Crypt/PWSafe3/PasswordPolicy.pm @@ -1,3 +1,8 @@ +# +# Copyright (c) 2011-2015 T.Linden . +# All Rights Reserved. Std. disclaimer applies. +# Artistic License, same as perl itself. Have fun. +# package Crypt::PWSafe3::PasswordPolicy; @@ -190,7 +195,7 @@ T. Linden =head1 COPYRIGHT -Copyright (c) 2011-2013 by T.Linden . +Copyright (c) 2011-2015 by T.Linden . All rights reserved. =head1 LICENSE diff --git a/lib/Crypt/PWSafe3/Record.pm b/lib/Crypt/PWSafe3/Record.pm index 07ce1fc..961bca4 100644 --- a/lib/Crypt/PWSafe3/Record.pm +++ b/lib/Crypt/PWSafe3/Record.pm @@ -1,3 +1,8 @@ +# +# Copyright (c) 2011-2015 T.Linden . +# All Rights Reserved. Std. disclaimer applies. +# Artistic License, same as perl itself. Have fun. +# package Crypt::PWSafe3::Record; use Carp::Heavy; @@ -325,7 +330,7 @@ T. Linden =head1 COPYRIGHT -Copyright (c) 2011-2013 by T.Linden . +Copyright (c) 2011-2015 by T.Linden . All rights reserved. =head1 LICENSE diff --git a/lib/Crypt/PWSafe3/SHA256.pm b/lib/Crypt/PWSafe3/SHA256.pm index 452f6dd..0e8a995 100644 --- a/lib/Crypt/PWSafe3/SHA256.pm +++ b/lib/Crypt/PWSafe3/SHA256.pm @@ -1,4 +1,8 @@ # +# Copyright (c) 2011-2015 T.Linden . +# All Rights Reserved. Std. disclaimer applies. +# Artistic License, same as perl itself. Have fun. +# # helper class to provide SHA-256 to HMAC class package Crypt::PWSafe3::SHA256; @@ -44,7 +48,7 @@ L =head1 COPYRIGHT -Copyright (c) 2011-2013 by T.Linden . +Copyright (c) 2011-2015 by T.Linden . All rights reserved. =head1 LICENSE