diff options
author | 2002-06-05 21:55:44 +0000 | |
---|---|---|
committer | 2002-06-05 21:55:44 +0000 | |
commit | f9ca96dcfdad60f4632dc8e137198b0e850da325 (patch) | |
tree | 2a10d49eca20c5da1f0826c318dff88d5f6208f9 /usr.bin/ssh/ssh-add.c | |
parent | try to avoid DNS here (diff) | |
download | wireguard-openbsd-f9ca96dcfdad60f4632dc8e137198b0e850da325.tar.xz wireguard-openbsd-f9ca96dcfdad60f4632dc8e137198b0e850da325.zip |
ssh-add -t life, Set lifetime (in seconds) when adding identities; ok provos@
Diffstat (limited to 'usr.bin/ssh/ssh-add.c')
-rw-r--r-- | usr.bin/ssh/ssh-add.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/usr.bin/ssh/ssh-add.c b/usr.bin/ssh/ssh-add.c index b7ecb332827..bb1942b7536 100644 --- a/usr.bin/ssh/ssh-add.c +++ b/usr.bin/ssh/ssh-add.c @@ -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> @@ -60,6 +60,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; @@ -161,6 +163,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); @@ -274,6 +288,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"); @@ -297,7 +312,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': @@ -326,6 +341,9 @@ main(int argc, char **argv) deleting = 1; sc_reader_id = optarg; break; + case 't': + lifetime = atoi(optarg); + break; default: usage(); ret = 1; |