[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.36 and 1.37

version 1.36, 1999/12/12 19:20:03 version 1.37, 2000/01/04 00:08:00
Line 21 
Line 21 
 #include "readconf.h"  #include "readconf.h"
 #include "uidswap.h"  #include "uidswap.h"
   
   /* Flag indicating whether IPv4 or IPv6.  This can be set on the command line.
      Default value is AF_UNSPEC means both IPv4 and IPv6. */
   int IPv4or6 = AF_UNSPEC;
   
 /* Flag indicating whether debug mode is on.  This can be set on the command line. */  /* Flag indicating whether debug mode is on.  This can be set on the command line. */
 int debug_flag = 0;  int debug_flag = 0;
   
Line 53 
Line 57 
 char *host;  char *host;
   
 /* socket address the host resolves to */  /* socket address the host resolves to */
 struct sockaddr_in hostaddr;  struct sockaddr_storage hostaddr;
   
 /*  /*
  * Flag to indicate that we have received a window change signal which has   * Flag to indicate that we have received a window change signal which has
Line 108 
Line 112 
         fprintf(stderr, "              forward them to the other side by connecting to host:port.\n");          fprintf(stderr, "              forward them to the other side by connecting to host:port.\n");
         fprintf(stderr, "  -C          Enable compression.\n");          fprintf(stderr, "  -C          Enable compression.\n");
         fprintf(stderr, "  -g          Allow remote hosts to connect to forwarded ports.\n");          fprintf(stderr, "  -g          Allow remote hosts to connect to forwarded ports.\n");
           fprintf(stderr, "  -4          Use IPv4 only.\n");
           fprintf(stderr, "  -6          Use IPv6 only.\n");
         fprintf(stderr, "  -o 'option' Process the option as if it was read from a configuration file.\n");          fprintf(stderr, "  -o 'option' Process the option as if it was read from a configuration file.\n");
         exit(1);          exit(1);
 }  }
Line 244 
Line 250 
                         optarg = NULL;                          optarg = NULL;
                 }                  }
                 switch (opt) {                  switch (opt) {
                   case '4':
                           IPv4or6 = AF_INET;
                           break;
   
                   case '6':
                           IPv4or6 = AF_INET6;
                           break;
   
                 case 'n':                  case 'n':
                         stdin_null_flag = 1;                          stdin_null_flag = 1;
                         break;                          break;
Line 341 
Line 355 
                         break;                          break;
   
                 case 'R':                  case 'R':
                         if (sscanf(optarg, "%hu:%255[^:]:%hu", &fwd_port, buf,                          if (sscanf(optarg, "%hu/%255[^/]/%hu", &fwd_port, buf,
                                    &fwd_host_port) != 3) {                              &fwd_host_port) != 3 &&
                               sscanf(optarg, "%hu:%255[^:]:%hu", &fwd_port, buf,
                               &fwd_host_port) != 3) {
                                 fprintf(stderr, "Bad forwarding specification '%s'.\n", optarg);                                  fprintf(stderr, "Bad forwarding specification '%s'.\n", optarg);
                                 usage();                                  usage();
                                 /* NOTREACHED */                                  /* NOTREACHED */
Line 351 
Line 367 
                         break;                          break;
   
                 case 'L':                  case 'L':
                         if (sscanf(optarg, "%hu:%255[^:]:%hu", &fwd_port, buf,                          if (sscanf(optarg, "%hu/%255[^/]/%hu", &fwd_port, buf,
                                    &fwd_host_port) != 3) {                              &fwd_host_port) != 3 &&
                               sscanf(optarg, "%hu:%255[^:]:%hu", &fwd_port, buf,
                               &fwd_host_port) != 3) {
                                 fprintf(stderr, "Bad forwarding specification '%s'.\n", optarg);                                  fprintf(stderr, "Bad forwarding specification '%s'.\n", optarg);
                                 usage();                                  usage();
                                 /* NOTREACHED */                                  /* NOTREACHED */
Line 465 
Line 483 
   
         /* Find canonic host name. */          /* Find canonic host name. */
         if (strchr(host, '.') == 0) {          if (strchr(host, '.') == 0) {
                 struct hostent *hp = gethostbyname(host);                  struct addrinfo hints;
                 if (hp != 0) {                  struct addrinfo *ai = NULL;
                         if (strchr(hp->h_name, '.') != 0)                  int errgai;
                                 host = xstrdup(hp->h_name);                  memset(&hints, 0, sizeof(hints));
                         else if (hp->h_aliases != 0                  hints.ai_family = AF_UNSPEC;
                                  && hp->h_aliases[0] != 0                  hints.ai_flags = AI_CANONNAME;
                                  && strchr(hp->h_aliases[0], '.') != 0)                  errgai = getaddrinfo(host, NULL, &hints, &ai);
                                 host = xstrdup(hp->h_aliases[0]);                  if (errgai == 0) {
                           if (ai->ai_canonname != NULL)
                                   host = xstrdup(ai->ai_canonname);
                           freeaddrinfo(ai);
                 }                  }
         }          }
         /* Disable rhosts authentication if not running as root. */          /* Disable rhosts authentication if not running as root. */
Line 579 
Line 600 
   
         /* Log into the remote system.  This never returns if the login fails. */          /* Log into the remote system.  This never returns if the login fails. */
         ssh_login(host_private_key_loaded, host_private_key,          ssh_login(host_private_key_loaded, host_private_key,
                   host, &hostaddr, original_real_uid);                    host, (struct sockaddr *)&hostaddr, original_real_uid);
   
         /* We no longer need the host private key.  Clear it now. */          /* We no longer need the host private key.  Clear it now. */
         if (host_private_key_loaded)          if (host_private_key_loaded)

Legend:
Removed from v.1.36  
changed lines
  Added in v.1.37