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