tRetrieve key from agent if socket path is provided - safe - password protected secret keeper
HTML git clone git://git.z3bra.org/safe.git
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
DIR commit abd3bdb063e173f695700fed0c8315d530902e9e
DIR parent 14e7a02ab133fab082e46e0f4d8ea9ec898acd12
HTML 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:
M safe.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
---
DIR diff --git a/safe.c b/safe.c
t@@ -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");