diff options
author | Ben Lindstrom <mouring@eviladmin.org> | 2001-03-26 13:44:06 +0000 |
---|---|---|
committer | Ben Lindstrom <mouring@eviladmin.org> | 2001-03-26 13:44:06 +0000 |
commit | d0fca423fcee576f4787d01f8bad3f9c0efd62ab (patch) | |
tree | 696cb73350804862b8e39ccb53dc4edff2f68976 /sshconnect2.c | |
parent | 7bfff36ca3acf469de9fcad98826562ea6c1fbbe (diff) | |
download | openssh-git-d0fca423fcee576f4787d01f8bad3f9c0efd62ab.tar.gz |
- markus@cvs.openbsd.org 2001/03/26 08:07:09
[authfile.c authfile.h ssh-add.c ssh-keygen.c ssh.c sshconnect.c
sshconnect.h sshconnect1.c sshconnect2.c sshd.c]
simpler key load/save interface, see authfile.h
Diffstat (limited to 'sshconnect2.c')
-rw-r--r-- | sshconnect2.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/sshconnect2.c b/sshconnect2.c index 86f3bb9b..f636fb3d 100644 --- a/sshconnect2.c +++ b/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; } |