summaryrefslogtreecommitdiff
path: root/authfd.c
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2002-06-06 21:54:57 +0000
committerBen Lindstrom <mouring@eviladmin.org>2002-06-06 21:54:57 +0000
commit61d328acf9d0adcb10a254d072dafa84fb14b78f (patch)
tree974cd00f825192cda0f43acf3f82579d431eab5a /authfd.c
parent163f3b8f6be475e4fc28358846d0bed7bf0587e4 (diff)
downloadopenssh-git-61d328acf9d0adcb10a254d072dafa84fb14b78f.tar.gz
- markus@cvs.openbsd.org 2002/06/05 21:55:44
[authfd.c authfd.h ssh-add.1 ssh-add.c ssh-agent.c] ssh-add -t life, Set lifetime (in seconds) when adding identities; ok provos@
Diffstat (limited to 'authfd.c')
-rw-r--r--authfd.c37
1 files changed, 36 insertions, 1 deletions
diff --git a/authfd.c b/authfd.c
index c9c22d46..0f84e321 100644
--- a/authfd.c
+++ b/authfd.c
@@ -35,7 +35,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: authfd.c,v 1.50 2002/06/05 19:57:12 markus Exp $");
+RCSID("$OpenBSD: authfd.c,v 1.51 2002/06/05 21:55:44 markus Exp $");
#include <openssl/evp.h>
@@ -552,6 +552,41 @@ ssh_remove_identity(AuthenticationConnection *auth, Key *key)
}
int
+ssh_lifetime_identity(AuthenticationConnection *auth, Key *key, u_int life)
+{
+ Buffer msg;
+ int type;
+ u_char *blob;
+ u_int blen;
+
+ buffer_init(&msg);
+
+ if (key->type == KEY_RSA1) {
+ buffer_put_char(&msg, SSH_AGENTC_LIFETIME_IDENTITY1);
+ buffer_put_int(&msg, life);
+ buffer_put_int(&msg, BN_num_bits(key->rsa->n));
+ buffer_put_bignum(&msg, key->rsa->e);
+ buffer_put_bignum(&msg, key->rsa->n);
+ } else if (key->type == KEY_DSA || key->type == KEY_RSA) {
+ key_to_blob(key, &blob, &blen);
+ buffer_put_char(&msg, SSH_AGENTC_LIFETIME_IDENTITY);
+ buffer_put_int(&msg, life);
+ buffer_put_string(&msg, blob, blen);
+ xfree(blob);
+ } else {
+ buffer_free(&msg);
+ return 0;
+ }
+ 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);
+}
+
+int
ssh_update_card(AuthenticationConnection *auth, int add, const char *reader_id, const char *pin)
{
Buffer msg;