[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.35.2.3 and 1.36

version 1.35.2.3, 2003/04/03 22:35:18 version 1.36, 2002/06/16 21:30:58
Line 109 
Line 109 
   
         if (!(lb = malloc(sizeof(*lb)))) {          if (!(lb = malloc(sizeof(*lb)))) {
                 if (errfun)                  if (errfun)
                         (*errfun) ("linebuf (%s): malloc failed\n",                          (*errfun) ("linebuf (%s): malloc failed\n", lb->filename);
                             filename ? filename : "(stdin)");  
                 return (NULL);                  return (NULL);
         }          }
         if (filename) {          if (filename) {
Line 165 
Line 164 
 Linebuf_getline(Linebuf * lb)  Linebuf_getline(Linebuf * lb)
 {  {
         int n = 0;          int n = 0;
         void *p;  
   
         lb->lineno++;          lb->lineno++;
         for (;;) {          for (;;) {
                 /* Read a line */                  /* Read a line */
                 if (!fgets(&lb->buf[n], lb->size - n, lb->stream)) {                  if (!fgets(&lb->buf[n], lb->size - n, lb->stream)) {
                         if (ferror(lb->stream) && lb->errfun)                          if (ferror(lb->stream) && lb->errfun)
                                 (*lb->errfun)("%s: %s\n", lb->filename,                                  (*lb->errfun) ("%s: %s\n", lb->filename,
                                     strerror(errno));                                      strerror(errno));
                         return (NULL);                          return (NULL);
                 }                  }
Line 185 
Line 183 
                 }                  }
                 if (n != lb->size - 1) {                  if (n != lb->size - 1) {
                         if (lb->errfun)                          if (lb->errfun)
                                 (*lb->errfun)("%s: skipping incomplete last line\n",                                  (*lb->errfun) ("%s: skipping incomplete last line\n",
                                     lb->filename);                                      lb->filename);
                         return (NULL);                          return (NULL);
                 }                  }
                 /* Double the buffer if we need more space */                  /* Double the buffer if we need more space */
                 lb->size *= 2;                  if (!(lb->buf = realloc(lb->buf, (lb->size *= 2)))) {
                 if ((p = realloc(lb->buf, lb->size)) == NULL) {  
                         lb->size /= 2;  
                         if (lb->errfun)                          if (lb->errfun)
                                 (*lb->errfun)("linebuf (%s): realloc failed\n",                                  (*lb->errfun) ("linebuf (%s): realloc failed\n",
                                     lb->filename);                                      lb->filename);
                         return (NULL);                          return (NULL);
                 }                  }
                 lb->buf = p;  
         }          }
 }  }
   
Line 219 
Line 214 
 fdlim_set(int lim)  fdlim_set(int lim)
 {  {
         struct rlimit rlfd;          struct rlimit rlfd;
   
         if (lim <= 0)          if (lim <= 0)
                 return (-1);                  return (-1);
         if (getrlimit(RLIMIT_NOFILE, &rlfd) < 0)          if (getrlimit(RLIMIT_NOFILE, &rlfd) < 0)
Line 335 
Line 329 
         myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS] = c->c_keytype == KT_DSA?          myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS] = c->c_keytype == KT_DSA?
             "ssh-dss": "ssh-rsa";              "ssh-dss": "ssh-rsa";
         c->c_kex = kex_setup(myproposal);          c->c_kex = kex_setup(myproposal);
         c->c_kex->kex[KEX_DH_GRP1_SHA1] = kexdh_client;  
         c->c_kex->kex[KEX_DH_GEX_SHA1] = kexgex_client;  
         c->c_kex->verify_host_key = hostjump;          c->c_kex->verify_host_key = hostjump;
   
         if (!(j = setjmp(kexjmp))) {          if (!(j = setjmp(kexjmp))) {
Line 400 
Line 392 
 static int  static int
 conalloc(char *iname, char *oname, int keytype)  conalloc(char *iname, char *oname, int keytype)
 {  {
         char *namebase, *name, *namelist;  
         int s;          int s;
           char *namebase, *name, *namelist;
   
         namebase = namelist = xstrdup(iname);          namebase = namelist = xstrdup(iname);
   
Line 465 
Line 457 
 static int  static int
 conrecycle(int s)  conrecycle(int s)
 {  {
         con *c = &fdcon[s];  
         int ret;          int ret;
           con *c = &fdcon[s];
   
         ret = conalloc(c->c_namelist, c->c_output_name, c->c_keytype);          ret = conalloc(c->c_namelist, c->c_output_name, c->c_keytype);
         confree(s);          confree(s);
Line 476 
Line 468 
 static void  static void
 congreet(int s)  congreet(int s)
 {  {
         int remote_major, remote_minor, n = 0;  
         char buf[256], *cp;          char buf[256], *cp;
         char remote_version[sizeof buf];          char remote_version[sizeof buf];
         size_t bufsiz;          size_t bufsiz;
           int remote_major, remote_minor, n = 0;
         con *c = &fdcon[s];          con *c = &fdcon[s];
   
         bufsiz = sizeof(buf);          bufsiz = sizeof(buf);
Line 543 
Line 535 
 static void  static void
 conread(int s)  conread(int s)
 {  {
         con *c = &fdcon[s];  
         int n;          int n;
           con *c = &fdcon[s];
   
         if (c->c_status == CS_CON) {          if (c->c_status == CS_CON) {
                 congreet(s);                  congreet(s);
Line 583 
Line 575 
 static void  static void
 conloop(void)  conloop(void)
 {  {
         struct timeval seltime, now;  
         fd_set *r, *e;          fd_set *r, *e;
         con *c;          struct timeval seltime, now;
         int i;          int i;
           con *c;
   
         gettimeofday(&now, NULL);          gettimeofday(&now, NULL);
         c = TAILQ_FIRST(&tq);          c = TAILQ_FIRST(&tq);
Line 653 
Line 645 
 fatal(const char *fmt,...)  fatal(const char *fmt,...)
 {  {
         va_list args;          va_list args;
   
         va_start(args, fmt);          va_start(args, fmt);
         do_log(SYSLOG_LEVEL_FATAL, fmt, args);          do_log(SYSLOG_LEVEL_FATAL, fmt, args);
         va_end(args);          va_end(args);
Line 666 
Line 657 
 static void  static void
 usage(void)  usage(void)
 {  {
         fprintf(stderr, "usage: %s [-v46] [-p port] [-T timeout] [-f file]\n"          fprintf(stderr, "Usage: %s [options] host ...\n",
             "\t\t   [host | addrlist namelist] [...]\n",  
             __progname);              __progname);
           fprintf(stderr, "Options:\n");
           fprintf(stderr, "  -f file     Read hosts or addresses from file.\n");
           fprintf(stderr, "  -p port     Connect to the specified port.\n");
           fprintf(stderr, "  -t keytype  Specify the host key type.\n");
           fprintf(stderr, "  -T timeout  Set connection timeout.\n");
           fprintf(stderr, "  -v          Verbose; display verbose debugging messages.\n");
           fprintf(stderr, "  -4          Use IPv4 only.\n");
           fprintf(stderr, "  -6          Use IPv6 only.\n");
         exit(1);          exit(1);
 }  }
   
Line 697 
Line 695 
                         }                          }
                         break;                          break;
                 case 'T':                  case 'T':
                         timeout = convtime(optarg);                          timeout = atoi(optarg);
                         if (timeout == -1 || timeout == 0) {                          if (timeout <= 0)
                                 fprintf(stderr, "Bad timeout '%s'\n", optarg);  
                                 usage();                                  usage();
                         }  
                         break;                          break;
                 case 'v':                  case 'v':
                         if (!debug_flag) {                          if (!debug_flag) {

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