diff options
Diffstat (limited to 'ssh.c')
-rw-r--r-- | ssh.c | 41 |
1 files changed, 23 insertions, 18 deletions
@@ -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 | } |