diff options
author | Ben Lindstrom <mouring@eviladmin.org> | 2001-03-09 00:12:22 +0000 |
---|---|---|
committer | Ben Lindstrom <mouring@eviladmin.org> | 2001-03-09 00:12:22 +0000 |
commit | 266dfdfd62d169c62618d73cd72df0391c072be1 (patch) | |
tree | 3a51150147ab8fbc365f4d285b3046202bb1a2fc /ssh.c | |
parent | 283cb821cda4e05b33a1e87854db276757e9fdf8 (diff) |
- markus@cvs.openbsd.org 2001/03/08 21:42:33
[compat.c compat.h readconf.h ssh.c sshconnect1.c sshconnect2.c]
implement client side of SSH2_MSG_USERAUTH_PK_OK (test public key ->
no need to do enter passphrase or do expensive sign operations if the
server does not accept key).
Diffstat (limited to 'ssh.c')
-rw-r--r-- | ssh.c | 46 |
1 files changed, 35 insertions, 11 deletions
@@ -39,7 +39,7 @@ | |||
39 | */ | 39 | */ |
40 | 40 | ||
41 | #include "includes.h" | 41 | #include "includes.h" |
42 | RCSID("$OpenBSD: ssh.c,v 1.103 2001/03/04 17:42:28 millert Exp $"); | 42 | RCSID("$OpenBSD: ssh.c,v 1.104 2001/03/08 21:42:32 markus Exp $"); |
43 | 43 | ||
44 | #include <openssl/evp.h> | 44 | #include <openssl/evp.h> |
45 | #include <openssl/err.h> | 45 | #include <openssl/err.h> |
@@ -233,7 +233,7 @@ rsh_connect(char *host, char *user, Buffer * command) | |||
233 | 233 | ||
234 | int ssh_session(void); | 234 | int ssh_session(void); |
235 | int ssh_session2(void); | 235 | int ssh_session2(void); |
236 | int guess_identity_file_type(const char *filename); | 236 | void load_public_identity_files(void); |
237 | 237 | ||
238 | /* | 238 | /* |
239 | * Main program for the ssh client. | 239 | * Main program for the ssh client. |
@@ -678,15 +678,11 @@ main(int ac, char **av) | |||
678 | } | 678 | } |
679 | exit(1); | 679 | exit(1); |
680 | } | 680 | } |
681 | /* Expand ~ in options.identity_files, known host file names. */ | 681 | /* load options.identity_files */ |
682 | /* XXX mem-leaks */ | 682 | load_public_identity_files(); |
683 | for (i = 0; i < options.num_identity_files; i++) { | 683 | |
684 | options.identity_files[i] = | 684 | /* Expand ~ in known host file names. */ |
685 | tilde_expand_filename(options.identity_files[i], original_real_uid); | 685 | /* XXX mem-leaks: */ |
686 | options.identity_files_type[i] = guess_identity_file_type(options.identity_files[i]); | ||
687 | debug("identity file %s type %d", options.identity_files[i], | ||
688 | options.identity_files_type[i]); | ||
689 | } | ||
690 | options.system_hostfile = | 686 | options.system_hostfile = |
691 | tilde_expand_filename(options.system_hostfile, original_real_uid); | 687 | tilde_expand_filename(options.system_hostfile, original_real_uid); |
692 | options.user_hostfile = | 688 | options.user_hostfile = |
@@ -1095,3 +1091,31 @@ guess_identity_file_type(const char *filename) | |||
1095 | key_free(public); | 1091 | key_free(public); |
1096 | return type; | 1092 | return type; |
1097 | } | 1093 | } |
1094 | |||
1095 | void | ||
1096 | load_public_identity_files(void) | ||
1097 | { | ||
1098 | char *filename; | ||
1099 | Key *public; | ||
1100 | int i; | ||
1101 | |||
1102 | for (i = 0; i < options.num_identity_files; i++) { | ||
1103 | filename = tilde_expand_filename(options.identity_files[i], | ||
1104 | original_real_uid); | ||
1105 | public = key_new(KEY_RSA1); | ||
1106 | if (!load_public_key(filename, public, NULL)) { | ||
1107 | key_free(public); | ||
1108 | public = key_new(KEY_UNSPEC); | ||
1109 | if (!try_load_public_key(filename, public, NULL)) { | ||
1110 | debug("unknown identity file %s", filename); | ||
1111 | key_free(public); | ||
1112 | public = NULL; | ||
1113 | } | ||
1114 | } | ||
1115 | debug("identity file %s type %d", filename, | ||
1116 | public ? public->type : -1); | ||
1117 | xfree(options.identity_files[i]); | ||
1118 | options.identity_files[i] = filename; | ||
1119 | options.identity_keys[i] = public; | ||
1120 | } | ||
1121 | } | ||