diff options
author | mouring <mouring> | 2002-06-06 21:54:57 +0000 |
---|---|---|
committer | mouring <mouring> | 2002-06-06 21:54:57 +0000 |
commit | 619238e32c9e2164456e05ca0e92313b8e577e36 (patch) | |
tree | 3ad7ca3dd5c4fe89a3f8917f43de415cd8e953ea /ssh-add.c | |
parent | ab72d1ce2f7efb1ab62188e193cd9820e27f73c8 (diff) | |
download | openssh-619238e32c9e2164456e05ca0e92313b8e577e36.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 'ssh-add.c')
-rw-r--r-- | ssh-add.c | 22 |
1 files changed, 20 insertions, 2 deletions
@@ -35,7 +35,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: ssh-add.c,v 1.55 2002/06/05 20:56:39 markus Exp $"); +RCSID("$OpenBSD: ssh-add.c,v 1.56 2002/06/05 21:55:44 markus Exp $"); #include <openssl/evp.h> @@ -66,6 +66,8 @@ static char *default_files[] = { NULL }; +/* Default lifetime (0 == forever) */ +static u_int lifetime = 0; /* we keep a cache of one passphrases */ static char *pass = NULL; @@ -167,6 +169,18 @@ add_file(AuthenticationConnection *ac, const char *filename) } else fprintf(stderr, "Could not add identity: %s\n", filename); + if (ret == 0 && lifetime != 0) { + if (ssh_lifetime_identity(ac, private, lifetime)) { + fprintf(stderr, + "Lifetime set to %d seconds for: %s (%s)\n", + lifetime, filename, comment); + } else { + fprintf(stderr, + "Could not set lifetime for identity: %s\n", + filename); + } + } + xfree(comment); key_free(private); @@ -280,6 +294,7 @@ usage(void) fprintf(stderr, " -D Delete all identities.\n"); fprintf(stderr, " -x Lock agent.\n"); fprintf(stderr, " -x Unlock agent.\n"); + fprintf(stderr, " -t life Set lifetime (in seconds) when adding identities.\n"); #ifdef SMARTCARD fprintf(stderr, " -s reader Add key in smartcard reader.\n"); fprintf(stderr, " -e reader Remove key in smartcard reader.\n"); @@ -307,7 +322,7 @@ main(int argc, char **argv) fprintf(stderr, "Could not open a connection to your authentication agent.\n"); exit(2); } - while ((ch = getopt(argc, argv, "lLdDxXe:s:")) != -1) { + while ((ch = getopt(argc, argv, "lLdDxXe:s:t:")) != -1) { switch (ch) { case 'l': case 'L': @@ -336,6 +351,9 @@ main(int argc, char **argv) deleting = 1; sc_reader_id = optarg; break; + case 't': + lifetime = atoi(optarg); + break; default: usage(); ret = 1; |