*/
#include "includes.h"
-RCSID("$OpenBSD: ssh-add.c,v 1.59 2002/06/15 00:07:38 markus Exp $");
+RCSID("$OpenBSD: ssh-add.c,v 1.64 2002/11/21 23:03:51 deraadt Exp $");
#include <openssl/evp.h>
strlcpy(msg, "Bad passphrase, try again: ", sizeof msg);
}
}
- if (ssh_add_identity(ac, private, comment)) {
+
+ if (ssh_add_identity_constrained(ac, private, comment, lifetime)) {
fprintf(stderr, "Identity added: %s (%s)\n", filename, comment);
ret = 0;
- } else
- fprintf(stderr, "Could not add identity: %s\n", filename);
-
- if (ret == 0 && lifetime != 0) {
- if (ssh_constrain_identity(ac, private, lifetime)) {
- fprintf(stderr,
- "Lifetime set to %d seconds for: %s (%s)\n",
- lifetime, filename, comment);
- } else {
+ if (lifetime != 0)
fprintf(stderr,
- "Could not set lifetime for identity: %s\n",
- filename);
- }
+ "Lifetime set to %d seconds\n", lifetime);
+ } else if (ssh_add_identity(ac, private, comment)) {
+ fprintf(stderr, "Identity added: %s (%s)\n", filename, comment);
+ ret = 0;
+ } else {
+ fprintf(stderr, "Could not add identity: %s\n", filename);
}
xfree(comment);
{
char prompt[100], *p1, *p2;
int passok = 1, ret = -1;
-
+
strlcpy(prompt, "Enter lock password: ", sizeof(prompt));
p1 = read_passphrase(prompt, RP_ALLOW_STDIN);
if (lock) {
fprintf(stderr, "Failed to %slock agent.\n", lock ? "" : "un");
memset(p1, 0, strlen(p1));
xfree(p1);
- return -1;
+ return (ret);
}
static int
fprintf(stderr, " -d Delete identity.\n");
fprintf(stderr, " -D Delete all identities.\n");
fprintf(stderr, " -x Lock agent.\n");
- fprintf(stderr, " -x Unlock 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");