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

Diff for /src/usr.bin/ssh/ssh-keyscan.c between version 1.30 and 1.30.2.1

version 1.30, 2001/10/08 19:05:05 version 1.30.2.1, 2002/03/07 17:37:47
Line 469 
Line 469 
 congreet(int s)  congreet(int s)
 {  {
         char buf[256], *cp;          char buf[256], *cp;
           char remote_version[sizeof buf];
         size_t bufsiz;          size_t bufsiz;
         int n = 0;          int remote_major, remote_minor, n = 0;
         con *c = &fdcon[s];          con *c = &fdcon[s];
   
         bufsiz = sizeof(buf);          bufsiz = sizeof(buf);
Line 486 
Line 487 
                 conrecycle(s);                  conrecycle(s);
                 return;                  return;
         }          }
           if (n == 0) {
                   error("%s: Connection closed by remote host", c->c_name);
                   conrecycle(s);
                   return;
           }
         if (*cp != '\n' && *cp != '\r') {          if (*cp != '\n' && *cp != '\r') {
                 error("%s: bad greeting", c->c_name);                  error("%s: bad greeting", c->c_name);
                 confree(s);                  confree(s);
                 return;                  return;
         }          }
         *cp = '\0';          *cp = '\0';
           if (sscanf(buf, "SSH-%d.%d-%[^\n]\n",
               &remote_major, &remote_minor, remote_version) == 3)
                   compat_datafellows(remote_version);
           else
                   datafellows = 0;
         if (c->c_keytype != KT_RSA1) {          if (c->c_keytype != KT_RSA1) {
                 int remote_major, remote_minor;  
                 char remote_version[sizeof buf];  
   
                 if (sscanf(buf, "SSH-%d.%d-%[^\n]\n",  
                     &remote_major, &remote_minor, remote_version) == 3)  
                         compat_datafellows(remote_version);  
                 else  
                         datafellows = 0;  
                 if (!ssh2_capable(remote_major, remote_minor)) {                  if (!ssh2_capable(remote_major, remote_minor)) {
                         debug("%s doesn't support ssh2", c->c_name);                          debug("%s doesn't support ssh2", c->c_name);
                         confree(s);                          confree(s);
                         return;                          return;
                 }                  }
           } else if (remote_major != 1) {
                   debug("%s doesn't support ssh1", c->c_name);
                   confree(s);
                   return;
         }          }
         fprintf(stderr, "# %s %s\n", c->c_name, chop(buf));          fprintf(stderr, "# %s %s\n", c->c_name, chop(buf));
         n = snprintf(buf, sizeof buf, "SSH-%d.%d-OpenSSH-keyscan\r\n",          n = snprintf(buf, sizeof buf, "SSH-%d.%d-OpenSSH-keyscan\r\n",
Line 623 
Line 630 
         char *name = strnnsep(&host, " \t\n");          char *name = strnnsep(&host, " \t\n");
         int j;          int j;
   
           if (name == NULL)
                   return;
         for (j = KT_RSA1; j <= KT_RSA; j *= 2) {          for (j = KT_RSA1; j <= KT_RSA; j *= 2) {
                 if (get_keytypes & j) {                  if (get_keytypes & j) {
                         while (ncon >= MAXCON)                          while (ncon >= MAXCON)
Line 632 
Line 641 
         }          }
 }  }
   
 static void  void
 fatal_callback(void *arg)  fatal(const char *fmt,...)
 {  {
           va_list args;
           va_start(args, fmt);
           do_log(SYSLOG_LEVEL_FATAL, fmt, args);
           va_end(args);
         if (nonfatal_fatal)          if (nonfatal_fatal)
                 longjmp(kexjmp, -1);                  longjmp(kexjmp, -1);
           else
                   fatal_cleanup();
 }  }
   
 static void  static void
Line 649 
Line 664 
         fprintf(stderr, "  -p port     Connect to the specified port.\n");          fprintf(stderr, "  -p port     Connect to the specified port.\n");
         fprintf(stderr, "  -t keytype  Specify the host key type.\n");          fprintf(stderr, "  -t keytype  Specify the host key type.\n");
         fprintf(stderr, "  -T timeout  Set connection timeout.\n");          fprintf(stderr, "  -T timeout  Set connection timeout.\n");
         fprintf(stderr, "  -v          Verbose; display verbose debugging messages.\n");          fprintf(stderr, "  -v          Verbose; display verbose debugging messages.\n");
         fprintf(stderr, "  -4          Use IPv4 only.\n");          fprintf(stderr, "  -4          Use IPv4 only.\n");
         fprintf(stderr, "  -6          Use IPv6 only.\n");          fprintf(stderr, "  -6          Use IPv6 only.\n");
         exit(1);          exit(1);
 }  }
   
Line 715 
Line 730 
                                         get_keytypes |= KT_RSA;                                          get_keytypes |= KT_RSA;
                                         break;                                          break;
                                 case KEY_UNSPEC:                                  case KEY_UNSPEC:
                                         fatal("unknown key type %s\n", tname);                                          fatal("unknown key type %s", tname);
                                 }                                  }
                                 tname = strtok(NULL, ",");                                  tname = strtok(NULL, ",");
                         }                          }
Line 735 
Line 750 
                 usage();                  usage();
   
         log_init("ssh-keyscan", log_level, SYSLOG_FACILITY_USER, 1);          log_init("ssh-keyscan", log_level, SYSLOG_FACILITY_USER, 1);
         fatal_add_cleanup(fatal_callback, NULL);  
   
         maxfd = fdlim_get(1);          maxfd = fdlim_get(1);
         if (maxfd < 0)          if (maxfd < 0)

Legend:
Removed from v.1.30  
changed lines
  Added in v.1.30.2.1