[BACK]Return to ssh.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / ssh

Diff for /src/usr.bin/ssh/ssh.c between version 1.332 and 1.333

version 1.332, 2010/01/26 01:28:35 version 1.333, 2010/02/08 10:50:20
Line 94 
Line 94 
 #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;
Line 349 
Line 349 
                             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':
Line 1286 
Line 1286 
         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],
Line 1303 
Line 1306 
                             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);

Legend:
Removed from v.1.332  
changed lines
  Added in v.1.333