Fix storage corruption when using manual password - pee - Pee a password manager;Pee - because you have to...
(HTM) git clone git://vernunftzentrum.de/pee.git
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) LICENSE
---
(DIR) commit 5386c77f2b716e81236a93f1b1b817c7f28287fe
(DIR) parent 0bdcc0c509429af0b90d130e5d23b277decab24e
(HTM) Author: Christian Kellermann <ckeen@pestilenz.org>
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(-)
---
(DIR) 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-loop)))
+ (unless (equal? p1 p2) (print "Passwords do not match.") (manual-loop))
+ 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 passphrase) "#f") read)
+ (db (or (with-input-from-string
+ (or (decrypt-file db-name passphrase) "#f") read)
(begin (print "Error while decrypting " db-name ", wrong key?") (exit 1)))))
(cond
((alist-ref 'change-passphrase opts)