diff options
author | Markus Friedl <markus@cvs.openbsd.org> | 2001-03-26 08:07:10 +0000 |
---|---|---|
committer | Markus Friedl <markus@cvs.openbsd.org> | 2001-03-26 08:07:10 +0000 |
commit | 5197bb0e77fbb51e9b575c8ced78d232b9b45a43 (patch) | |
tree | 0906a92133bce6dd08f7fae1801c7c05a8f3680a /usr.bin/ssh/sshconnect2.c | |
parent | f4eb1785519495ac3cd38888663c189ea6e3b526 (diff) |
simpler key load/save interface, see authfile.h
Diffstat (limited to 'usr.bin/ssh/sshconnect2.c')
-rw-r--r-- | usr.bin/ssh/sshconnect2.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/usr.bin/ssh/sshconnect2.c b/usr.bin/ssh/sshconnect2.c index 86f3bb9b2d1..f636fb3d92f 100644 --- a/usr.bin/ssh/sshconnect2.c +++ b/usr.bin/ssh/sshconnect2.c @@ -23,7 +23,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: sshconnect2.c,v 1.55 2001/03/23 11:04:07 djm Exp $"); +RCSID("$OpenBSD: sshconnect2.c,v 1.56 2001/03/26 08:07:09 markus Exp $"); #include <openssl/bn.h> #include <openssl/md5.h> @@ -901,26 +901,24 @@ load_identity_file(char *filename) { Key *private; char prompt[300], *passphrase; - int success = 0, quit, i; + int quit, i; struct stat st; if (stat(filename, &st) < 0) { debug3("no such identity: %s", filename); return NULL; } - private = key_new(KEY_UNSPEC); - if (!load_private_key(filename, "", private, NULL)) { - if (options.batch_mode) { - key_free(private); + private = key_load_private_type(KEY_UNSPEC, filename, "", NULL); + if (private == NULL) { + if (options.batch_mode) return NULL; - } snprintf(prompt, sizeof prompt, "Enter passphrase for key '%.100s': ", filename); for (i = 0; i < options.number_of_password_prompts; i++) { passphrase = read_passphrase(prompt, 0); if (strcmp(passphrase, "") != 0) { - success = load_private_key(filename, - passphrase, private, NULL); + private = key_load_private_type(KEY_UNSPEC, filename, + passphrase, NULL); quit = 0; } else { debug2("no passphrase given, try next key"); @@ -928,14 +926,10 @@ load_identity_file(char *filename) } memset(passphrase, 0, strlen(passphrase)); xfree(passphrase); - if (success || quit) + if (private != NULL || quit) break; debug2("bad passphrase given, try again..."); } - if (!success) { - key_free(private); - return NULL; - } } return private; } |