Fix storage corruption when using manual password - pee - Pee a password manag… | |
git clone git://vernunftzentrum.de/pee.git | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit 5386c77f2b716e81236a93f1b1b817c7f28287fe | |
parent 0bdcc0c509429af0b90d130e5d23b277decab24e | |
Author: Christian Kellermann <[email protected]> | |
Date: Sat, 9 Jan 2016 17:22:17 +0100 | |
Fix storage corruption when using manual password | |
This has been caused by the refactoring of new-password. An unspecified | |
value sneaked in twice, resulting in read to fail. Maybe we should add a | |
recovery mode by trying to make as much sense of the read back file as | |
possible? | |
Diffstat: | |
pee.scm | 11 +++++++---- | |
1 file changed, 7 insertions(+), 4 deletions(-) | |
--- | |
diff --git a/pee.scm b/pee.scm | |
@@ -72,13 +72,15 @@ | |
'(not echo) | |
(lambda () | |
(printf "Enter new password: ") | |
- (read-line) | |
- (print "\r")))) | |
+ (let ((l (read-line))) | |
+ (print "\r") | |
+ l)))) | |
(let manual-loop () | |
(if (ask-yes-or-no "Invent your own password?") | |
(let ((p1 (ask-for-manual-password)) | |
(p2 (ask-for-manual-password))) | |
- (unless (equal? p1 p2) (print "Passwords do not match.") (manual-loo… | |
+ (unless (equal? p1 p2) (print "Passwords do not match.") (manual-loo… | |
+ p1) | |
(let password-loop ((e wanted-entropy)) | |
(let ((p (generate-new-password e)) | |
(entropy-delta (cond ((< e 64) 8) | |
@@ -357,7 +359,8 @@ | |
(init (do-init db-name '())) | |
(else | |
(let* ((passphrase (get-hashed-passphrase)) | |
- (db (or (with-input-from-string (or (decrypt-file db-name passphr… | |
+ (db (or (with-input-from-string | |
+ (or (decrypt-file db-name passphrase) "#f") read) | |
(begin (print "Error while decrypting " db-name ", wrong … | |
(cond | |
((alist-ref 'change-passphrase opts) |