[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.405 and 1.406

version 1.405, 2014/07/03 06:39:19 version 1.406, 2014/07/15 15:54:14
Line 87 
Line 87 
 #include "dispatch.h"  #include "dispatch.h"
 #include "clientloop.h"  #include "clientloop.h"
 #include "log.h"  #include "log.h"
   #include "misc.h"
 #include "readconf.h"  #include "readconf.h"
 #include "sshconnect.h"  #include "sshconnect.h"
 #include "misc.h"  
 #include "kex.h"  #include "kex.h"
 #include "mac.h"  #include "mac.h"
 #include "sshpty.h"  #include "sshpty.h"
Line 409 
Line 409 
         int timeout_ms;          int timeout_ms;
         extern int optind, optreset;          extern int optind, optreset;
         extern char *optarg;          extern char *optarg;
         Forward fwd;          struct Forward fwd;
         struct addrinfo *addrs = NULL;          struct addrinfo *addrs = NULL;
         struct ssh_digest_ctx *md;          struct ssh_digest_ctx *md;
         u_char conn_hash[SSH_DIGEST_MAX_LENGTH];          u_char conn_hash[SSH_DIGEST_MAX_LENGTH];
Line 516 
Line 516 
                         options.forward_x11_trusted = 1;                          options.forward_x11_trusted = 1;
                         break;                          break;
                 case 'g':                  case 'g':
                         options.gateway_ports = 1;                          options.fwd_opts.gateway_ports = 1;
                         break;                          break;
                 case 'O':                  case 'O':
                         if (stdio_forward_host != NULL)                          if (stdio_forward_host != NULL)
Line 1256 
Line 1256 
 static void  static void
 ssh_confirm_remote_forward(int type, u_int32_t seq, void *ctxt)  ssh_confirm_remote_forward(int type, u_int32_t seq, void *ctxt)
 {  {
         Forward *rfwd = (Forward *)ctxt;          struct Forward *rfwd = (struct Forward *)ctxt;
   
         /* XXX verbose() on failure? */          /* XXX verbose() on failure? */
         debug("remote forward %s for: listen %s%s%d, connect %s:%d",          debug("remote forward %s for: listen %s%s%d, connect %s:%d",
             type == SSH2_MSG_REQUEST_SUCCESS ? "success" : "failure",              type == SSH2_MSG_REQUEST_SUCCESS ? "success" : "failure",
             rfwd->listen_host == NULL ? "" : rfwd->listen_host,              rfwd->listen_path ? rfwd->listen_path :
             rfwd->listen_host == NULL ? "" : ":",              rfwd->listen_host ? rfwd->listen_host : "",
             rfwd->listen_port, rfwd->connect_host, rfwd->connect_port);              (rfwd->listen_path || rfwd->listen_host) ? ":" : "",
         if (rfwd->listen_port == 0) {              rfwd->listen_port, rfwd->connect_path ? rfwd->connect_path :
               rfwd->connect_host, rfwd->connect_port);
           if (rfwd->listen_path == NULL && rfwd->listen_port == 0) {
                 if (type == SSH2_MSG_REQUEST_SUCCESS) {                  if (type == SSH2_MSG_REQUEST_SUCCESS) {
                         rfwd->allocated_port = packet_get_int();                          rfwd->allocated_port = packet_get_int();
                         logit("Allocated port %u for remote forward to %s:%d",                          logit("Allocated port %u for remote forward to %s:%d",
Line 1278 
Line 1280 
         }          }
   
         if (type == SSH2_MSG_REQUEST_FAILURE) {          if (type == SSH2_MSG_REQUEST_FAILURE) {
                 if (options.exit_on_forward_failure)                  if (options.exit_on_forward_failure) {
                         fatal("Error: remote port forwarding failed for "                          if (rfwd->listen_path != NULL)
                             "listen port %d", rfwd->listen_port);                                  fatal("Error: remote port forwarding failed "
                 else                                      "for listen path %s", rfwd->listen_path);
                         logit("Warning: remote port forwarding failed for "                          else
                             "listen port %d", rfwd->listen_port);                                  fatal("Error: remote port forwarding failed "
                                       "for listen port %d", rfwd->listen_port);
                   } else {
                           if (rfwd->listen_path != NULL)
                                   logit("Warning: remote port forwarding failed "
                                       "for listen path %s", rfwd->listen_path);
                           else
                                   logit("Warning: remote port forwarding failed "
                                       "for listen port %d", rfwd->listen_port);
                   }
         }          }
         if (++remote_forward_confirms_received == options.num_remote_forwards) {          if (++remote_forward_confirms_received == options.num_remote_forwards) {
                 debug("All remote forwarding requests processed");                  debug("All remote forwarding requests processed");
Line 1331 
Line 1342 
         for (i = 0; i < options.num_local_forwards; i++) {          for (i = 0; i < options.num_local_forwards; i++) {
                 debug("Local connections to %.200s:%d forwarded to remote "                  debug("Local connections to %.200s:%d forwarded to remote "
                     "address %.200s:%d",                      "address %.200s:%d",
                       (options.local_forwards[i].listen_path != NULL) ?
                       options.local_forwards[i].listen_path :
                     (options.local_forwards[i].listen_host == NULL) ?                      (options.local_forwards[i].listen_host == NULL) ?
                     (options.gateway_ports ? "*" : "LOCALHOST") :                      (options.fwd_opts.gateway_ports ? "*" : "LOCALHOST") :
                     options.local_forwards[i].listen_host,                      options.local_forwards[i].listen_host,
                     options.local_forwards[i].listen_port,                      options.local_forwards[i].listen_port,
                       (options.local_forwards[i].connect_path != NULL) ?
                       options.local_forwards[i].connect_path :
                     options.local_forwards[i].connect_host,                      options.local_forwards[i].connect_host,
                     options.local_forwards[i].connect_port);                      options.local_forwards[i].connect_port);
                 success += channel_setup_local_fwd_listener(                  success += channel_setup_local_fwd_listener(
                     options.local_forwards[i].listen_host,                      &options.local_forwards[i], &options.fwd_opts);
                     options.local_forwards[i].listen_port,  
                     options.local_forwards[i].connect_host,  
                     options.local_forwards[i].connect_port,  
                     options.gateway_ports);  
         }          }
         if (i > 0 && success != i && options.exit_on_forward_failure)          if (i > 0 && success != i && options.exit_on_forward_failure)
                 fatal("Could not request local forwarding.");                  fatal("Could not request local forwarding.");
Line 1353 
Line 1364 
         for (i = 0; i < options.num_remote_forwards; i++) {          for (i = 0; i < options.num_remote_forwards; i++) {
                 debug("Remote connections from %.200s:%d forwarded to "                  debug("Remote connections from %.200s:%d forwarded to "
                     "local address %.200s:%d",                      "local address %.200s:%d",
                       (options.remote_forwards[i].listen_path != NULL) ?
                       options.remote_forwards[i].listen_path :
                     (options.remote_forwards[i].listen_host == NULL) ?                      (options.remote_forwards[i].listen_host == NULL) ?
                     "LOCALHOST" : options.remote_forwards[i].listen_host,                      "LOCALHOST" : options.remote_forwards[i].listen_host,
                     options.remote_forwards[i].listen_port,                      options.remote_forwards[i].listen_port,
                       (options.remote_forwards[i].connect_path != NULL) ?
                       options.remote_forwards[i].connect_path :
                     options.remote_forwards[i].connect_host,                      options.remote_forwards[i].connect_host,
                     options.remote_forwards[i].connect_port);                      options.remote_forwards[i].connect_port);
                 options.remote_forwards[i].handle =                  options.remote_forwards[i].handle =
                     channel_request_remote_forwarding(                      channel_request_remote_forwarding(
                     options.remote_forwards[i].listen_host,                      &options.remote_forwards[i]);
                     options.remote_forwards[i].listen_port,  
                     options.remote_forwards[i].connect_host,  
                     options.remote_forwards[i].connect_port);  
                 if (options.remote_forwards[i].handle < 0) {                  if (options.remote_forwards[i].handle < 0) {
                         if (options.exit_on_forward_failure)                          if (options.exit_on_forward_failure)
                                 fatal("Could not request remote forwarding.");                                  fatal("Could not request remote forwarding.");

Legend:
Removed from v.1.405  
changed lines
  Added in v.1.406