Introduction
Introduction Statistics Contact Development Disclaimer Help
Warn the user before overwriting an existing db with init. - pee - Pee a passwo…
git clone git://vernunftzentrum.de/pee.git
Log
Files
Refs
LICENSE
---
commit cda319bcb34d3f10945787e0085d13ebb9099d45
parent 579387ed5a16560041d32558bd7b3959ce4402ad
Author: Christian Kellermann <[email protected]>
Date: Wed, 20 Apr 2016 22:38:04 +0200
Warn the user before overwriting an existing db with init.
Diffstat:
pee.scm | 24 ++++++++++++++++--------
todo.org | 1 -
2 files changed, 16 insertions(+), 9 deletions(-)
---
diff --git a/pee.scm b/pee.scm
@@ -349,14 +349,22 @@
(exit 1))))
(define (do-init db-name content)
- (print "I will ask you twice for the passphrase to encrypt the password stor…
- (let ((passphrase1 (get-hashed-passphrase))
- (passphrase2 (get-hashed-passphrase)))
- (unless (equal? passphrase1 passphrase2)
- (print "Error: Passphrases do not match.")
- (exit 1))
- (encrypt-file db-name content passphrase1)
- (print "Password store " db-name " initialised.")))
+ (define (really-init)
+ (print "I will ask you twice for the passphrase to encrypt the password st…
+ (let ((passphrase1 (get-hashed-passphrase))
+ (passphrase2 (get-hashed-passphrase)))
+ (unless (equal? passphrase1 passphrase2)
+ (print "Error: Passphrases do not match.")
+ (exit 1))
+ (encrypt-file db-name content passphrase1)
+ (print "Password store " db-name " initialised.")))
+ (cond ((and (check-access db-name)
+ (ask-yes-or-no (sprintf "~a does exist, do you want to OVERWRITE…
+ (really-init))
+ ((not (check-access db-name))
+ (really-init))
+ (else
+ (print "Nothing done."))))
(define (do-change-passphrase db-name db old-passphrase)
(print "I will ask you twice for the new passphrase.")
diff --git a/todo.org b/todo.org
@@ -1,5 +1,4 @@
* TODOs
** Do we need to feed arc4random into tweetnacl for better randomness?
-** initialise-db should not overwrite the file so easily
** Add a version counter to the file, so we can make assumptions about the fil…
You are viewing proxied material from vernunftzentrum.de. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.