summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorKevin Steves <stevesk@cvs.openbsd.org>2002-06-10 17:36:24 +0000
committerKevin Steves <stevesk@cvs.openbsd.org>2002-06-10 17:36:24 +0000
commit7b31a8311b0d2d4546217e9f3ce4f80604c88957 (patch)
tree0643ba1e99e0c801172184ba1a12b153f6e05287 /usr.bin
parent25818e44b2f8326b49dcc5eeca3e2a4c0cf56de9 (diff)
use convtime() to parse and validate key lifetime. can now
use '-t 2h' etc. ok markus@ provos@
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/ssh/ssh-add.16
-rw-r--r--usr.bin/ssh/ssh-add.c11
2 files changed, 12 insertions, 5 deletions
diff --git a/usr.bin/ssh/ssh-add.1 b/usr.bin/ssh/ssh-add.1
index 350d1031dcd..bbf34203dc5 100644
--- a/usr.bin/ssh/ssh-add.1
+++ b/usr.bin/ssh/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/usr.bin/ssh/ssh-add.c b/usr.bin/ssh/ssh-add.c
index bb1942b7536..716f6f66bc7 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.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"
/* argv0 */
extern char *__progname;
@@ -61,7 +62,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;
@@ -342,7 +343,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();