safe

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

commit abd3bdb063e173f695700fed0c8315d530902e9e
parent 14e7a02ab133fab082e46e0f4d8ea9ec898acd12
Author: Willy Goiffon <dev@z3bra.org>
Date:   Mon,  3 Jun 2019 17:55:36 +0200

Retrieve key from agent if socket path is provided

Diffstat:
safe.c | 11++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/safe.c b/safe.c @@ -426,9 +426,14 @@ main(int argc, char *argv[]) err(1, "chdir: %s", safe); } - readsalt(s.salt, sizeof(s.salt)); - readpass("password:", &passphrase, &pplen); - deriv((char *)passphrase, &s); + if (sockp || (sockp = getenv("SAFE_SOCK"))) { + if (readkey(&s, sockp) < 0) + err(1, "%s", sockp); + } else { + readsalt(s.salt, sizeof(s.salt)); + readpass("password:", &passphrase, &pplen); + deriv((char *)passphrase, &s); + } if (secret_exists(MASTER) && check_master(&s) < 0) { fprintf(stderr, "master password incorrect\n");