diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | ssh.c | 41 |
2 files changed, 28 insertions, 19 deletions
@@ -45,6 +45,10 @@ | |||
45 | Inquire Cyberflex class for 0xf0 cards | 45 | Inquire Cyberflex class for 0xf0 cards |
46 | change aid to conform to 7816-5 | 46 | change aid to conform to 7816-5 |
47 | remove gratuitous fid selects | 47 | remove gratuitous fid selects |
48 | - millert@cvs.openbsd.org 2001/07/27 14:50:45 | ||
49 | [ssh.c] | ||
50 | If smart card support is compiled in and a smart card is being used | ||
51 | for authentication, make it the first method used. markus@ OK | ||
48 | 52 | ||
49 | 20010803 | 53 | 20010803 |
50 | - (djm) Fix interrupted read in entropy gatherer. Spotted by markus@ on | 54 | - (djm) Fix interrupted read in entropy gatherer. Spotted by markus@ on |
@@ -6155,4 +6159,4 @@ | |||
6155 | - Wrote replacements for strlcpy and mkdtemp | 6159 | - Wrote replacements for strlcpy and mkdtemp |
6156 | - Released 1.0pre1 | 6160 | - Released 1.0pre1 |
6157 | 6161 | ||
6158 | $Id: ChangeLog,v 1.1438 2001/08/06 21:10:52 mouring Exp $ | 6162 | $Id: ChangeLog,v 1.1439 2001/08/06 21:12:42 mouring Exp $ |
@@ -39,7 +39,7 @@ | |||
39 | */ | 39 | */ |
40 | 40 | ||
41 | #include "includes.h" | 41 | #include "includes.h" |
42 | RCSID("$OpenBSD: ssh.c,v 1.130 2001/07/25 14:35:18 markus Exp $"); | 42 | RCSID("$OpenBSD: ssh.c,v 1.131 2001/07/27 14:50:45 millert Exp $"); |
43 | 43 | ||
44 | #include <openssl/evp.h> | 44 | #include <openssl/evp.h> |
45 | #include <openssl/err.h> | 45 | #include <openssl/err.h> |
@@ -1153,44 +1153,49 @@ load_public_identity_files(void) | |||
1153 | { | 1153 | { |
1154 | char *filename; | 1154 | char *filename; |
1155 | Key *public; | 1155 | Key *public; |
1156 | int i; | 1156 | int i = 0; |
1157 | 1157 | ||
1158 | for (i = 0; i < options.num_identity_files; i++) { | ||
1159 | filename = tilde_expand_filename(options.identity_files[i], | ||
1160 | original_real_uid); | ||
1161 | public = key_load_public(filename, NULL); | ||
1162 | debug("identity file %s type %d", filename, | ||
1163 | public ? public->type : -1); | ||
1164 | xfree(options.identity_files[i]); | ||
1165 | options.identity_files[i] = filename; | ||
1166 | options.identity_keys[i] = public; | ||
1167 | } | ||
1168 | #ifdef SMARTCARD | 1158 | #ifdef SMARTCARD |
1169 | if (sc_reader_num != -1 && | 1159 | if (sc_reader_num != -1 && |
1170 | options.num_identity_files + 1 < SSH_MAX_IDENTITY_FILES && | 1160 | options.num_identity_files + 1 < SSH_MAX_IDENTITY_FILES && |
1171 | (public = sc_get_key(sc_reader_num)) != NULL ) { | 1161 | (public = sc_get_key(sc_reader_num)) != NULL ) { |
1172 | Key *new; | 1162 | Key *new; |
1173 | 1163 | ||
1164 | if (options.num_identity_files + 2 > SSH_MAX_IDENTITY_FILES) | ||
1165 | options.num_identity_files = SSH_MAX_IDENTITY_FILES - 2; | ||
1166 | memmove(&options.identity_files[2], &options.identity_files[0], | ||
1167 | sizeof(char *) * options.num_identity_files); | ||
1168 | options.num_identity_files += 2; | ||
1169 | i = 2; | ||
1170 | |||
1174 | /* XXX ssh1 vs ssh2 */ | 1171 | /* XXX ssh1 vs ssh2 */ |
1175 | new = key_new(KEY_RSA); | 1172 | new = key_new(KEY_RSA); |
1176 | new->flags = KEY_FLAG_EXT; | 1173 | new->flags = KEY_FLAG_EXT; |
1177 | BN_copy(new->rsa->n, public->rsa->n); | 1174 | BN_copy(new->rsa->n, public->rsa->n); |
1178 | BN_copy(new->rsa->e, public->rsa->e); | 1175 | BN_copy(new->rsa->e, public->rsa->e); |
1179 | RSA_set_method(new->rsa, sc_get_engine()); | 1176 | RSA_set_method(new->rsa, sc_get_engine()); |
1180 | i = options.num_identity_files++; | 1177 | options.identity_keys[0] = new; |
1181 | options.identity_keys[i] = new; | 1178 | options.identity_files[0] = xstrdup("smartcard rsa key");; |
1182 | options.identity_files[i] = xstrdup("smartcard rsa key");; | ||
1183 | 1179 | ||
1184 | new = key_new(KEY_RSA1); | 1180 | new = key_new(KEY_RSA1); |
1185 | new->flags = KEY_FLAG_EXT; | 1181 | new->flags = KEY_FLAG_EXT; |
1186 | BN_copy(new->rsa->n, public->rsa->n); | 1182 | BN_copy(new->rsa->n, public->rsa->n); |
1187 | BN_copy(new->rsa->e, public->rsa->e); | 1183 | BN_copy(new->rsa->e, public->rsa->e); |
1188 | RSA_set_method(new->rsa, sc_get_engine()); | 1184 | RSA_set_method(new->rsa, sc_get_engine()); |
1189 | i = options.num_identity_files++; | 1185 | options.identity_keys[1] = new; |
1190 | options.identity_keys[i] = new; | 1186 | options.identity_files[1] = xstrdup("smartcard rsa1 key"); |
1191 | options.identity_files[i] = xstrdup("smartcard rsa1 key");; | ||
1192 | 1187 | ||
1193 | key_free(public); | 1188 | key_free(public); |
1194 | } | 1189 | } |
1195 | #endif | 1190 | #endif |
1191 | for (; i < options.num_identity_files; i++) { | ||
1192 | filename = tilde_expand_filename(options.identity_files[i], | ||
1193 | original_real_uid); | ||
1194 | public = key_load_public(filename, NULL); | ||
1195 | debug("identity file %s type %d", filename, | ||
1196 | public ? public->type : -1); | ||
1197 | xfree(options.identity_files[i]); | ||
1198 | options.identity_files[i] = filename; | ||
1199 | options.identity_keys[i] = public; | ||
1200 | } | ||
1196 | } | 1201 | } |