version 1.332, 2010/01/26 01:28:35 |
version 1.333, 2010/02/08 10:50:20 |
|
|
#include "roaming.h" |
#include "roaming.h" |
#include "version.h" |
#include "version.h" |
|
|
#ifdef SMARTCARD |
#ifdef ENABLE_PKCS11 |
#include "scard.h" |
#include "ssh-pkcs11.h" |
#endif |
#endif |
|
|
extern char *__progname; |
extern char *__progname; |
|
|
xstrdup(optarg); |
xstrdup(optarg); |
break; |
break; |
case 'I': |
case 'I': |
#ifdef SMARTCARD |
#ifdef ENABLE_PKCS11 |
options.smartcard_device = xstrdup(optarg); |
options.pkcs11_provider = xstrdup(optarg); |
#else |
#else |
fprintf(stderr, "no support for smartcards.\n"); |
fprintf(stderr, "no support for PKCS#11.\n"); |
#endif |
#endif |
break; |
break; |
case 't': |
case 't': |
|
|
int i = 0; |
int i = 0; |
Key *public; |
Key *public; |
struct passwd *pw; |
struct passwd *pw; |
#ifdef SMARTCARD |
#ifdef ENABLE_PKCS11 |
Key **keys; |
Key **keys; |
|
int nkeys; |
|
|
if (options.smartcard_device != NULL && |
if (options.pkcs11_provider != NULL && |
options.num_identity_files < SSH_MAX_IDENTITY_FILES && |
options.num_identity_files < SSH_MAX_IDENTITY_FILES && |
(keys = sc_get_keys(options.smartcard_device, NULL)) != NULL) { |
(pkcs11_init(!options.batch_mode) == 0) && |
|
(nkeys = pkcs11_add_provider(options.pkcs11_provider, NULL, |
|
&keys)) > 0) { |
int count = 0; |
int count = 0; |
for (i = 0; keys[i] != NULL; i++) { |
for (i = 0; i < nkeys; i++) { |
count++; |
count++; |
memmove(&options.identity_files[1], |
memmove(&options.identity_files[1], |
&options.identity_files[0], |
&options.identity_files[0], |
|
|
sizeof(Key *) * (SSH_MAX_IDENTITY_FILES - 1)); |
sizeof(Key *) * (SSH_MAX_IDENTITY_FILES - 1)); |
options.num_identity_files++; |
options.num_identity_files++; |
options.identity_keys[0] = keys[i]; |
options.identity_keys[0] = keys[i]; |
options.identity_files[0] = sc_get_key_label(keys[i]); |
options.identity_files[0] = |
|
xstrdup(options.pkcs11_provider); /* XXX */ |
} |
} |
if (options.num_identity_files > SSH_MAX_IDENTITY_FILES) |
if (options.num_identity_files > SSH_MAX_IDENTITY_FILES) |
options.num_identity_files = SSH_MAX_IDENTITY_FILES; |
options.num_identity_files = SSH_MAX_IDENTITY_FILES; |
i = count; |
i = count; |
xfree(keys); |
xfree(keys); |
|
/* XXX leaks some keys */ |
} |
} |
#endif /* SMARTCARD */ |
#endif /* ENABLE_PKCS11 */ |
if ((pw = getpwuid(original_real_uid)) == NULL) |
if ((pw = getpwuid(original_real_uid)) == NULL) |
fatal("load_public_identity_files: getpwuid failed"); |
fatal("load_public_identity_files: getpwuid failed"); |
pwname = xstrdup(pw->pw_name); |
pwname = xstrdup(pw->pw_name); |