summaryrefslogtreecommitdiff
path: root/authfd.c
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2002-06-06 21:52:03 +0000
committerBen Lindstrom <mouring@eviladmin.org>2002-06-06 21:52:03 +0000
commit2f71704b42891fbb486b1925e522ea95739fa8ca (patch)
tree5ec11dbd740c8d7a92fd783f162faf0bd3df224a /authfd.c
parent21d1ed8303c0d766b5bb1b3f0e54a7e28ae3c577 (diff)
downloadopenssh-git-2f71704b42891fbb486b1925e522ea95739fa8ca.tar.gz
- markus@cvs.openbsd.org 2002/06/05 19:57:12
[authfd.c authfd.h ssh-add.1 ssh-add.c ssh-agent.c] ssh-add -x for lock and -X for unlocking the agent. todo: encrypt private keys with locked...
Diffstat (limited to 'authfd.c')
-rw-r--r--authfd.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/authfd.c b/authfd.c
index f3050d64..c9c22d46 100644
--- a/authfd.c
+++ b/authfd.c
@@ -35,7 +35,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: authfd.c,v 1.49 2002/03/21 22:44:05 rees Exp $");
+RCSID("$OpenBSD: authfd.c,v 1.50 2002/06/05 19:57:12 markus Exp $");
#include <openssl/evp.h>
@@ -207,6 +207,26 @@ ssh_close_authentication_connection(AuthenticationConnection *auth)
xfree(auth);
}
+/* Lock/unlock agent */
+int
+ssh_lock_agent(AuthenticationConnection *auth, int lock, const char *password)
+{
+ int type;
+ Buffer msg;
+
+ buffer_init(&msg);
+ buffer_put_char(&msg, lock ? SSH_AGENTC_LOCK : SSH_AGENTC_UNLOCK);
+ buffer_put_cstring(&msg, password);
+
+ if (ssh_request_reply(auth, &msg, &msg) == 0) {
+ buffer_free(&msg);
+ return 0;
+ }
+ type = buffer_get_char(&msg);
+ buffer_free(&msg);
+ return decode_reply(type);
+}
+
/*
* Returns the first authentication identity held by the agent.
*/