safe

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

commit 5815c87b10844807519a2966560882d4966520ed
parent 7a35319955c94c158db21a7e368e58f974830d05
Author: Willy Goiffon <dev@z3bra.org>
Date:   Thu,  6 Jun 2019 18:27:57 +0200

Send salt from agent

Diffstat:
safe.c | 9++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/safe.c b/safe.c @@ -206,6 +206,7 @@ agent(struct safe *s, char *sockp) printf("SAFE_SOCK=%s\n", path); while ((cfd = accept(sfd, NULL, NULL)) > 0) { + xwrite(cfd, s->salt, sizeof(s->salt)); xwrite(cfd, s->key, sizeof(s->key)); close(cfd); } @@ -230,7 +231,13 @@ readkey(struct safe *s, char *path) if (connect(sfd, (struct sockaddr *)&addr, sizeof(addr)) < 0) return -1; - xread(sfd, s->key, sizeof(s->key), NULL); + if (xread(sfd, s->salt, sizeof(s->salt), NULL) < 0) + return -1; + + if (xread(sfd, s->key, sizeof(s->key), NULL) < 0) + return -1; + + close(sfd); return 0; }