[BACK]Return to hostfile.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / crypto / external / bsd / openssh / dist

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/crypto/external/bsd/openssh/dist/hostfile.c between version 1.11 and 1.12

version 1.11, 2017/10/07 19:39:19 version 1.12, 2018/08/26 07:46:36
Line 1 
Line 1 
 /*      $NetBSD$        */  /*      $NetBSD$        */
 /* $OpenBSD: hostfile.c,v 1.71 2017/05/31 09:15:42 deraadt Exp $ */  /* $OpenBSD: hostfile.c,v 1.73 2018/07/16 03:09:13 djm Exp $ */
   
 /*  /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>   * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland   * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
Line 664  hostkeys_foreach(const char *path, hostk
Line 665  hostkeys_foreach(const char *path, hostk
     const char *host, const char *ip, u_int options)      const char *host, const char *ip, u_int options)
 {  {
         FILE *f;          FILE *f;
         char line[8192], oline[8192], ktype[128];          char *line = NULL, ktype[128];
         u_long linenum = 0;          u_long linenum = 0;
         char *cp, *cp2;          char *cp, *cp2;
         u_int kbits;          u_int kbits;
         int hashed;          int hashed;
         int s, r = 0;          int s, r = 0;
         struct hostkey_foreach_line lineinfo;          struct hostkey_foreach_line lineinfo;
         size_t l;          size_t linesize = 0, l;
   
         memset(&lineinfo, 0, sizeof(lineinfo));          memset(&lineinfo, 0, sizeof(lineinfo));
         if (host == NULL && (options & HKF_WANT_MATCH) != 0)          if (host == NULL && (options & HKF_WANT_MATCH) != 0)
Line 680  hostkeys_foreach(const char *path, hostk
Line 681  hostkeys_foreach(const char *path, hostk
                 return SSH_ERR_SYSTEM_ERROR;                  return SSH_ERR_SYSTEM_ERROR;
   
         debug3("%s: reading file \"%s\"", __func__, path);          debug3("%s: reading file \"%s\"", __func__, path);
         while (read_keyfile_line(f, path, line, sizeof(line), &linenum) == 0) {          while (getline(&line, &linesize, f) != -1) {
                   linenum++;
                 line[strcspn(line, "\n")] = '\0';                  line[strcspn(line, "\n")] = '\0';
                 strlcpy(oline, line, sizeof(oline));  
   
                   free(lineinfo.line);
                 sshkey_free(lineinfo.key);                  sshkey_free(lineinfo.key);
                 memset(&lineinfo, 0, sizeof(lineinfo));                  memset(&lineinfo, 0, sizeof(lineinfo));
                 lineinfo.path = path;                  lineinfo.path = path;
                 lineinfo.linenum = linenum;                  lineinfo.linenum = linenum;
                 lineinfo.line = oline;                  lineinfo.line = xstrdup(line);
                 lineinfo.marker = MRK_NONE;                  lineinfo.marker = MRK_NONE;
                 lineinfo.status = HKF_STATUS_OK;                  lineinfo.status = HKF_STATUS_OK;
                 lineinfo.keytype = KEY_UNSPEC;                  lineinfo.keytype = KEY_UNSPEC;
Line 827  hostkeys_foreach(const char *path, hostk
Line 829  hostkeys_foreach(const char *path, hostk
                         break;                          break;
         }          }
         sshkey_free(lineinfo.key);          sshkey_free(lineinfo.key);
           free(lineinfo.line);
           free(line);
         fclose(f);          fclose(f);
         return r;          return r;
 }  }

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12

CVSweb <webmaster@jp.NetBSD.org>