summaryrefslogtreecommitdiffstats
path: root/usr.bin/ssh/ssh-agent.c
diff options
context:
space:
mode:
authormarc <marc@openbsd.org>2003-01-21 18:14:36 +0000
committermarc <marc@openbsd.org>2003-01-21 18:14:36 +0000
commit8be5ec657bd94ca12394a7b4ab6bb3d993074380 (patch)
tree0fd6bf949ba25217ef48b304ae698205bc93826a /usr.bin/ssh/ssh-agent.c
parentreverse logic in dma sync flush as long as prewrite was given and purge for preread otherwise (diff)
downloadwireguard-openbsd-8be5ec657bd94ca12394a7b4ab6bb3d993074380.tar.xz
wireguard-openbsd-8be5ec657bd94ca12394a7b4ab6bb3d993074380.zip
Add a -t life option to ssh-agent that set the default lifetime.
The default can still be overriden by using -t in ssh-add. OK markus@
Diffstat (limited to 'usr.bin/ssh/ssh-agent.c')
-rw-r--r--usr.bin/ssh/ssh-agent.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/usr.bin/ssh/ssh-agent.c b/usr.bin/ssh/ssh-agent.c
index c72a54a5503..bbe9ae0b8ac 100644
--- a/usr.bin/ssh/ssh-agent.c
+++ b/usr.bin/ssh/ssh-agent.c
@@ -35,7 +35,7 @@
#include "includes.h"
#include <sys/queue.h>
-RCSID("$OpenBSD: ssh-agent.c,v 1.105 2002/10/01 20:34:12 markus Exp $");
+RCSID("$OpenBSD: ssh-agent.c,v 1.106 2003/01/21 18:14:36 marc Exp $");
#include <openssl/evp.h>
#include <openssl/md5.h>
@@ -102,6 +102,9 @@ char *lock_passwd = NULL;
extern char *__progname;
+/* Default lifetime (0 == forever) */
+static int lifetime = 0;
+
static void
close_socket(SocketEntry *e)
{
@@ -464,6 +467,8 @@ process_add_identity(SocketEntry *e, int version)
break;
}
}
+ if (lifetime && !death)
+ death = time(NULL) + lifetime;
if (lookup_identity(k, version) == NULL) {
Identity *id = xmalloc(sizeof(Identity));
id->key = k;
@@ -926,6 +931,7 @@ usage(void)
fprintf(stderr, " -k Kill the current agent.\n");
fprintf(stderr, " -d Debug mode.\n");
fprintf(stderr, " -a socket Bind agent socket to given name.\n");
+ fprintf(stderr, " -t life Default identity lifetime (seconds).\n");
exit(1);
}
@@ -948,7 +954,7 @@ main(int ac, char **av)
SSLeay_add_all_algorithms();
- while ((ch = getopt(ac, av, "cdksa:")) != -1) {
+ while ((ch = getopt(ac, av, "cdksa:t:")) != -1) {
switch (ch) {
case 'c':
if (s_flag)
@@ -971,6 +977,12 @@ main(int ac, char **av)
case 'a':
agentsocket = optarg;
break;
+ case 't':
+ if ((lifetime = convtime(optarg)) == -1) {
+ fprintf(stderr, "Invalid lifetime\n");
+ usage();
+ }
+ break;
default:
usage();
}