summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2002-06-11 15:51:54 +0000
committerBen Lindstrom <mouring@eviladmin.org>2002-06-11 15:51:54 +0000
commit1775c9c97af0559f7b6df766ce79d66a1e883379 (patch)
treeb4edba4e1b14b37dd429237688f08b1309bc472d
parent11d470de348beb5e9f6a2dcc27fdeb1ad8257acd (diff)
- stevesk@cvs.openbsd.org 2002/06/10 17:36:23
[ssh-add.1 ssh-add.c] use convtime() to parse and validate key lifetime. can now use '-t 2h' etc. ok markus@ provos@
-rw-r--r--ChangeLog6
-rw-r--r--ssh-add.16
-rw-r--r--ssh-add.c11
3 files changed, 17 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index f3a802f7..ff2b7715 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -13,6 +13,10 @@
- stevesk@cvs.openbsd.org 2002/06/10 16:56:30
[ssh-keysign.8]
merge in stuff from my man page; ok markus@
+ - stevesk@cvs.openbsd.org 2002/06/10 17:36:23
+ [ssh-add.1 ssh-add.c]
+ use convtime() to parse and validate key lifetime. can now
+ use '-t 2h' etc. ok markus@ provos@
20020609
- (bal) OpenBSD CVS Sync
@@ -878,4 +882,4 @@
- (stevesk) entropy.c: typo in debug message
- (djm) ssh-keygen -i needs seeded RNG; report from markus@
-$Id: ChangeLog,v 1.2203 2002/06/11 15:50:13 mouring Exp $
+$Id: ChangeLog,v 1.2204 2002/06/11 15:51:54 mouring Exp $
diff --git a/ssh-add.1 b/ssh-add.1
index 350d1031..bbf34203 100644
--- a/ssh-add.1
+++ b/ssh-add.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: ssh-add.1,v 1.33 2002/06/05 21:55:44 markus Exp $
+.\" $OpenBSD: ssh-add.1,v 1.34 2002/06/10 17:36:22 stevesk Exp $
.\"
.\" -*- nroff -*-
.\"
@@ -90,7 +90,9 @@ Lock the agent with a password.
Unlock the agent.
.It Fl t Ar life
Set a maximum lifetime when adding identities to an agent.
-The lifetime is specified in seconds.
+The lifetime may be specified in seconds or in a time format
+specified in
+.Xr sshd 8 .
.It Fl s Ar reader
Add key in smartcard
.Ar reader .
diff --git a/ssh-add.c b/ssh-add.c
index e4aa8a52..30d63540 100644
--- a/ssh-add.c
+++ b/ssh-add.c
@@ -35,7 +35,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: ssh-add.c,v 1.56 2002/06/05 21:55:44 markus Exp $");
+RCSID("$OpenBSD: ssh-add.c,v 1.57 2002/06/10 17:36:23 stevesk Exp $");
#include <openssl/evp.h>
@@ -48,6 +48,7 @@ RCSID("$OpenBSD: ssh-add.c,v 1.56 2002/06/05 21:55:44 markus Exp $");
#include "authfile.h"
#include "pathnames.h"
#include "readpass.h"
+#include "misc.h"
#ifdef HAVE___PROGNAME
extern char *__progname;
@@ -67,7 +68,7 @@ static char *default_files[] = {
};
/* Default lifetime (0 == forever) */
-static u_int lifetime = 0;
+static int lifetime = 0;
/* we keep a cache of one passphrases */
static char *pass = NULL;
@@ -352,7 +353,11 @@ main(int argc, char **argv)
sc_reader_id = optarg;
break;
case 't':
- lifetime = atoi(optarg);
+ if ((lifetime = convtime(optarg)) == -1) {
+ fprintf(stderr, "Invalid lifetime\n");
+ ret = 1;
+ goto done;
+ }
break;
default:
usage();