tSend salt from agent - 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 5815c87b10844807519a2966560882d4966520ed
DIR parent 7a35319955c94c158db21a7e368e58f974830d05
HTML Author: Willy Goiffon <dev@z3bra.org>
Date: Thu, 6 Jun 2019 18:27:57 +0200
Send salt from agent
Diffstat:
M safe.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
---
DIR diff --git a/safe.c b/safe.c
t@@ -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);
}
t@@ -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;
}