safe

Password protected secret keeper
git clone git://git.z3bra.org/safe.git
Log | Files | Refs | README | LICENSE

commit c07b6ff8bcc151cd80a182e7ee90aea3631a9386
parent 579eb5dc88c06576da5b3f159e28e71ecb65ae03
Author: Willy Goiffon <dev@z3bra.org>
Date:   Mon, 24 Jun 2019 14:48:25 +0200

Ask for password twice when creating master entry

Diffstat:
safe.c | 10++++++++++
1 file changed, 10 insertions(+), 0 deletions(-)

diff --git a/safe.c b/safe.c @@ -377,6 +377,16 @@ main(int argc, char *argv[]) /* write master password entry if not present */ if (fd < 0 && errno == ENOENT) { + uint8_t *passphrase2; + size_t pplen2; + + /* input for master password again to check */ + readpass("verify:", &passphrase2, &pplen2); + if (pplen != pplen2 || memcmp(passphrase, passphrase2, pplen)) { + fprintf(stderr, "password mismatch\n"); + return -1; + } + fd = open(MASTER, O_RDWR | O_CREAT | O_EXCL, 0600); if (fd < 0) err(1, "%s", MASTER);