diff options
author | Damien Miller <djm@mindrot.org> | 2000-07-21 10:19:44 +1000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2000-07-21 10:19:44 +1000 |
commit | 994cf1426d176e2ee9ba310416544c325e04b155 (patch) | |
tree | 8e8978bcec4c8a2aa83533936f90e7c3070e9def /ssh-add.c | |
parent | 9dec7762798a4f9268e6033945c6dde44925d853 (diff) |
- (djm) OpenBSD CVS updates:
- markus@cvs.openbsd.org 2000/07/16 02:27:22
[authfd.c authfd.h channels.c clientloop.c ssh-add.c ssh-agent.c ssh.c]
[sshconnect1.c sshconnect2.c]
make ssh-add accept dsa keys (the agent does not)
- djm@cvs.openbsd.org 2000/07/17 19:25:02
[sshd.c]
Another closing of stdin; ok deraadt
- markus@cvs.openbsd.org 2000/07/19 18:33:12
[dsa.c]
missing free, reorder
- markus@cvs.openbsd.org 2000/07/20 16:23:14
[ssh-keygen.1]
document input and output files
Diffstat (limited to 'ssh-add.c')
-rw-r--r-- | ssh-add.c | 18 |
1 files changed, 12 insertions, 6 deletions
@@ -7,7 +7,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: ssh-add.c,v 1.17 2000/06/20 01:39:44 markus Exp $"); +RCSID("$OpenBSD: ssh-add.c,v 1.18 2000/07/16 08:27:21 markus Exp $"); #include <openssl/rsa.h> #include <openssl/dsa.h> @@ -15,9 +15,9 @@ RCSID("$OpenBSD: ssh-add.c,v 1.17 2000/06/20 01:39:44 markus Exp $"); #include "rsa.h" #include "ssh.h" #include "xmalloc.h" -#include "authfd.h" #include "fingerprint.h" #include "key.h" +#include "authfd.h" #include "authfile.h" #ifdef HAVE___PROGNAME @@ -102,11 +102,17 @@ add_file(AuthenticationConnection *ac, const char *filename) char buf[1024], msg[1024]; int success; int interactive = isatty(STDIN_FILENO); + int type = KEY_RSA; + /* + * try to load the public key. right now this only works for RSA, + * since DSA keys are fully encrypted + */ public = key_new(KEY_RSA); if (!load_public_key(filename, public, &saved_comment)) { - printf("Bad key file %s: %s\n", filename, strerror(errno)); - return; + /* ok, so we will asume this is a DSA key */ + type = KEY_DSA; + saved_comment = xstrdup(filename); } key_free(public); @@ -118,7 +124,7 @@ add_file(AuthenticationConnection *ac, const char *filename) } /* At first, try empty passphrase */ - private = key_new(KEY_RSA); + private = key_new(type); success = load_private_key(filename, "", private, &comment); if (!success) { printf("Need passphrase for %.200s\n", filename); @@ -150,7 +156,7 @@ add_file(AuthenticationConnection *ac, const char *filename) } xfree(saved_comment); - if (ssh_add_identity(ac, private->rsa, comment)) + if (ssh_add_identity(ac, private, comment)) fprintf(stderr, "Identity added: %s (%s)\n", filename, comment); else fprintf(stderr, "Could not add identity: %s\n", filename); |