[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.116.2.4 and 1.116.2.5

version 1.116.2.4, 2002/03/09 00:20:45 version 1.116.2.5, 2002/06/02 22:56:11
Line 13 
Line 13 
  * called by a name other than "ssh" or "Secure Shell".   * called by a name other than "ssh" or "Secure Shell".
  *   *
  * Copyright (c) 1999 Niels Provos.  All rights reserved.   * Copyright (c) 1999 Niels Provos.  All rights reserved.
    * Copyright (c) 2000, 2001, 2002 Markus Friedl.  All rights reserved.
  *   *
  * Modified to work with SSL by Niels Provos <provos@citi.umich.edu>   * Modified to work with SSL by Niels Provos <provos@citi.umich.edu>
  * in Canada (German citizen).   * in Canada (German citizen).
Line 70 
Line 71 
 #include "sshtty.h"  #include "sshtty.h"
   
 #ifdef SMARTCARD  #ifdef SMARTCARD
 #include <openssl/engine.h>  
 #include "scard.h"  #include "scard.h"
 #endif  #endif
   
Line 138 
Line 138 
 /* Should we execute a command or invoke a subsystem? */  /* Should we execute a command or invoke a subsystem? */
 int subsystem_flag = 0;  int subsystem_flag = 0;
   
   /* # of replies received for global requests */
   static int client_global_request_id = 0;
   
 /* Prints a help message to the user.  This function never returns. */  /* Prints a help message to the user.  This function never returns. */
   
 static void  static void
Line 462 
Line 465 
                                 /* NOTREACHED */                                  /* NOTREACHED */
                         }                          }
                         if ((fwd_port = a2port(sfwd_port)) == 0 ||                          if ((fwd_port = a2port(sfwd_port)) == 0 ||
                             (fwd_host_port = a2port(sfwd_host_port)) == 0) {                              (fwd_host_port = a2port(sfwd_host_port)) == 0) {
                                 fprintf(stderr,                                  fprintf(stderr,
                                     "Bad forwarding port(s) '%s'\n", optarg);                                      "Bad forwarding port(s) '%s'\n", optarg);
                                 exit(1);                                  exit(1);
Line 1021 
Line 1024 
                     len, (u_char *)buffer_ptr(&command), id);                      len, (u_char *)buffer_ptr(&command), id);
 }  }
   
   void
   client_global_request_reply(int type, u_int32_t seq, void *ctxt)
   {
           int i;
   
           i = client_global_request_id++;
           if (i >= options.num_remote_forwards) {
                   debug("client_global_request_reply: too many replies %d > %d",
                       i, options.num_remote_forwards);
                   return;
           }
           debug("remote forward %s for: listen %d, connect %s:%d",
               type == SSH2_MSG_REQUEST_SUCCESS ? "success" : "failure",
               options.remote_forwards[i].port,
               options.remote_forwards[i].host,
               options.remote_forwards[i].host_port);
           if (type == SSH2_MSG_REQUEST_FAILURE)
                   log("Warning: remote port forwarding failed for listen port %d",
                       options.remote_forwards[i].port);
   }
   
 /* request pty/x11/agent/tcpfwd/shell for channel */  /* request pty/x11/agent/tcpfwd/shell for channel */
 static void  static void
 ssh_session2_setup(int id, void *arg)  ssh_session2_setup(int id, void *arg)
Line 1167 
Line 1191 
 load_public_identity_files(void)  load_public_identity_files(void)
 {  {
         char *filename;          char *filename;
         Key *public;  
         int i = 0;          int i = 0;
           Key *public;
 #ifdef SMARTCARD  #ifdef SMARTCARD
         if (options.smartcard_device != NULL &&          Key **keys;
             options.num_identity_files + 1 < SSH_MAX_IDENTITY_FILES &&  
             (public = sc_get_key(options.smartcard_device)) != NULL ) {  
                 Key *new;  
   
                 if (options.num_identity_files + 2 > SSH_MAX_IDENTITY_FILES)          if (options.smartcard_device != NULL &&
                         options.num_identity_files = SSH_MAX_IDENTITY_FILES - 2;              options.num_identity_files < SSH_MAX_IDENTITY_FILES &&
                 memmove(&options.identity_files[2], &options.identity_files[0],              (keys = sc_get_keys(options.smartcard_device, NULL)) != NULL ) {
                     sizeof(char *) * options.num_identity_files);                  int count = 0;
                 options.num_identity_files += 2;                  for (i = 0; keys[i] != NULL; i++) {
                 i = 2;                          count++;
                           memmove(&options.identity_files[1], &options.identity_files[0],
                 /* XXX ssh1 vs ssh2 */                              sizeof(char *) * (SSH_MAX_IDENTITY_FILES - 1));
                 new = key_new(KEY_RSA);                          memmove(&options.identity_keys[1], &options.identity_keys[0],
                 new->flags = KEY_FLAG_EXT;                              sizeof(Key *) * (SSH_MAX_IDENTITY_FILES - 1));
                 BN_copy(new->rsa->n, public->rsa->n);                          options.num_identity_files++;
                 BN_copy(new->rsa->e, public->rsa->e);                          options.identity_keys[0] = keys[i];
                 RSA_set_method(new->rsa, sc_get_engine());                          options.identity_files[0] = xstrdup("smartcard key");;
                 options.identity_keys[0] = new;                  }
                 options.identity_files[0] = xstrdup("smartcard rsa key");;                  if (options.num_identity_files > SSH_MAX_IDENTITY_FILES)
                           options.num_identity_files = SSH_MAX_IDENTITY_FILES;
                 new = key_new(KEY_RSA1);                  i = count;
                 new->flags = KEY_FLAG_EXT;                  xfree(keys);
                 BN_copy(new->rsa->n, public->rsa->n);  
                 BN_copy(new->rsa->e, public->rsa->e);  
                 RSA_set_method(new->rsa, sc_get_engine());  
                 options.identity_keys[1] = new;  
                 options.identity_files[1] = xstrdup("smartcard rsa1 key");  
   
                 key_free(public);  
         }          }
 #endif /* SMARTCARD */  #endif /* SMARTCARD */
         for (; i < options.num_identity_files; i++) {          for (; i < options.num_identity_files; i++) {

Legend:
Removed from v.1.116.2.4  
changed lines
  Added in v.1.116.2.5