FIXED: NOTEDB::pwsafe3 contained the old python stuff in delete code.

This commit is contained in:
TLINDEN
2012-02-10 20:39:00 +01:00
parent 77c359ffd7
commit b94997a1f5
5 changed files with 22 additions and 10 deletions

View File

@@ -1,3 +1,6 @@
1.3.11:
FIXED: NOTEDB::pwsafe3 contained the old python stuff in delete code.
================================================================================
1.3.10: 1.3.10:
FIXED: the YAML export/import change were missing too. grml... FIXED: the YAML export/import change were missing too. grml...
FIXED: NOTEDB::general backend fixed loading Config::General FIXED: NOTEDB::general backend fixed loading Config::General

View File

@@ -10,7 +10,7 @@ package NOTEDB;
use Exporter (); use Exporter ();
use vars qw(@ISA @EXPORT $crypt_supported); use vars qw(@ISA @EXPORT $crypt_supported);
$NOTEDB::VERSION = "1.33"; $NOTEDB::VERSION = "1.34";
BEGIN { BEGIN {
# make sure, it works, otherwise encryption # make sure, it works, otherwise encryption

View File

@@ -3,7 +3,7 @@
package NOTEDB::pwsafe3; package NOTEDB::pwsafe3;
$NOTEDB::pwsafe3::VERSION = "1.00"; $NOTEDB::pwsafe3::VERSION = "1.01";
use strict; use strict;
use Data::Dumper; use Data::Dumper;
@@ -228,22 +228,31 @@ sub set_new {
sub set_del { sub set_del {
my($this, $num) = @_; my($this, $num) = @_;
my $uuid = $this->_getuuid($num);
if(! $uuid) {
print "Note $num does not exist!\n";
return;
}
my $fh = new FileHandle "<$this->{dbname}" or die "could not open $this->{dbname}\n"; my $fh = new FileHandle "<$this->{dbname}" or die "could not open $this->{dbname}\n";
flock $fh, LOCK_EX; flock $fh, LOCK_EX;
my $key = $this->_getpass(); my $key = $this->_getpass();
eval { eval {
my $vault = new Vault($key, $this->{dbname}); my $vault = new Crypt::PWSafe3(password => $key, file => $this->{dbname});
$vault->delrecord($this->_getuuid($num)); delete $vault->{record}->{$uuid};
$vault->markmodified();
$vault->write_to_file($this->{dbname}, $key); $vault->save();
}; };
if ($@) { if ($@) {
print "Exception caught:\n$@\n"; print "Exception caught:\n$@\n";
exit 1; exit 1;
} }
flock $fh, LOCK_UN;
$fh->close(); eval {
flock $fh, LOCK_UN;
$fh->close();
};
# finally re-read the db, so that we always have the latest data # finally re-read the db, so that we always have the latest data
$this->_retrieve($key); $this->_retrieve($key);

2
README
View File

@@ -1,4 +1,4 @@
note 1.3.10 by Thomas Linden, 02/09/2012 note 1.3.11 by Thomas Linden, 02/10/2012
======================================= =======================================
Introduction Introduction

View File

@@ -141,7 +141,7 @@ $CONF = File::Spec->catfile($ENV{HOME}, ".noterc");
$USER = getlogin || getpwuid($<); $USER = getlogin || getpwuid($<);
chomp $USER; chomp $USER;
$TOPIC = 1; $TOPIC = 1;
$version = "1.3.10"; $version = "1.3.11";
$CurDepth = 1; # the current depth inside the topic "directory" structure... $CurDepth = 1; # the current depth inside the topic "directory" structure...
$maxlen = "auto"; $maxlen = "auto";
$timelen = 22; $timelen = 22;