Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Crypt-PWSafe3 CPAN distribution.

Report information
The Basics
Id: 75146
Status: resolved
Priority: 0/
Queue: Crypt-PWSafe3

People
Owner: tlinden [...] cpan.org
Requestors: luca.filipozzi [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: mtime and lastmod should not always be set identically
Date: Sun, 19 Feb 2012 22:28:39 -0800
To: bug-Crypt-PWSafe3 [...] rt.cpan.org
From: Luca Filipozzi <luca.filipozzi [...] gmail.com>
Hi, In http://search.cpan.org/perldoc?Crypt::PWSafe3::Record, you state "Note: I don't really know, what's the difference [of lastmod] to mtime, so, I update both. If someone knows better, please tell me.". I humbly submit this bug report in response. :) In http://search.cpan.org/perldoc?PasswordSafe, the various fields that are contained within a Password Safe record are enumerated. Field 0x08 contains the 'Password Modification Time' (mtime in your code) and field 0x0a contains the 'Last Modification Time' (lastmod in your code). There are two methods in package Crypt::PWSafe3::Record that manipulate these two fields: new() and modifyfield(). With regards to new(): - since the records' password is being set to an empty string, I agree that mtime (Password Modification Time) should be set. - since record is being modified (created, in fact), I agree that lastmod (Last Modification Time) should also be set. With regards to modifyfield(), I disagree that both mtime and lastmod should be set. lastmod (Last Modification Time) should be set if any field changes, including passwd. mtime (Password Modification Time), however, should only be set if the field being modified is passwd. I suggest that $this->addfield(new Crypt::PWSafe3::Field(name => 'mtime', value => time)); needs a guard such as $this->addfield(new Crypt::PWSafe3::Field(name => 'mtime', value => time)) if $name eq 'passwd'; Please let me know if I should provide more information. Thanks for reading this far and thanks, again, for a very useful package. Regards, Luca PS: nice metaprogramming! -- Luca Filipozzi
Subject: [rt.cpan.org #75146] mtime and lastmod should not always be set identically
Date: Sun, 19 Feb 2012 22:41:43 -0800
To: bug-Crypt-PWSafe3 [...] rt.cpan.org
From: Luca Filipozzi <luca.filipozzi [...] gmail.com>
One more comment: please consider storing the value of time() once and using the stored value multiple times. There is a small risk that the three invocations of time() in Crypt::PWSafe3::Record's new() method will span across a second change and the values of ctime, mtime and lastmod will differ by a second.
Subject: [rt.cpan.org #75146] mtime and lastmod should not always be set identically
Date: Sun, 19 Feb 2012 23:11:05 -0800
To: bug-Crypt-PWSafe3 [...] rt.cpan.org
From: Luca Filipozzi <luca.filipozzi [...] gmail.com>
In case it is of use to others, my workaround is: my $mtime = $record->mtime; # rt.cpan.org #75146 workaround # make changes to the record here (except passwd) $record->addfield(Crypt::PWSafe3::Field->new(name => 'mtime', value => $mtime)); $self->{pwsafe}->addrecord($record); $self->{pwsafe}->markmodified(); $self->{pwsafe}->save();
fixed in 1.04