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

Diff for /src/usr.bin/ssh/ssh-keygen.c between version 1.261 and 1.262

version 1.261, 2015/01/30 01:10:33 version 1.262, 2015/02/16 22:08:57
Line 1033 
Line 1033 
         char *hashed, *cp, *hosts, *ohosts;          char *hashed, *cp, *hosts, *ohosts;
         int has_wild = l->hosts && strcspn(l->hosts, "*?!") != strlen(l->hosts);          int has_wild = l->hosts && strcspn(l->hosts, "*?!") != strlen(l->hosts);
   
         /* Retain invalid lines when hashing, but mark file as invalid. */          switch (l->status) {
         if (l->status == HKF_STATUS_INVALID) {          case HKF_STATUS_OK:
           case HKF_STATUS_MATCHED:
                   /*
                    * Don't hash hosts already already hashed, with wildcard
                    * characters or a CA/revocation marker.
                    */
                   if ((l->match & HKF_MATCH_HOST_HASHED) != 0 ||
                       has_wild || l->marker != MRK_NONE) {
                           fprintf(ctx->out, "%s\n", l->line);
                           if (has_wild && !find_host) {
                                   fprintf(stderr, "%s:%ld: ignoring host name "
                                       "with wildcard: %.64s\n", l->path,
                                       l->linenum, l->hosts);
                           }
                           return 0;
                   }
                   /*
                    * Split any comma-separated hostnames from the host list,
                    * hash and store separately.
                    */
                   ohosts = hosts = xstrdup(l->hosts);
                   while ((cp = strsep(&hosts, ",")) != NULL && *cp != '\0') {
                           if ((hashed = host_hash(cp, NULL, 0)) == NULL)
                                   fatal("hash_host failed");
                           fprintf(ctx->out, "%s %s\n", hashed, l->rawkey);
                           ctx->has_unhashed = 1;
                   }
                   free(ohosts);
                   return 0;
           case HKF_STATUS_INVALID:
                   /* Retain invalid lines, but mark file as invalid. */
                 ctx->invalid = 1;                  ctx->invalid = 1;
                 fprintf(stderr, "%s:%ld: invalid line\n", l->path, l->linenum);                  fprintf(stderr, "%s:%ld: invalid line\n", l->path, l->linenum);
                   /* FALLTHROUGH */
           default:
                 fprintf(ctx->out, "%s\n", l->line);                  fprintf(ctx->out, "%s\n", l->line);
                 return 0;                  return 0;
         }          }
           /* NOTREACHED */
         /*          return -1;
          * Don't hash hosts already already hashed, with wildcard characters  
          * or a CA/revocation marker.  
          */  
         if (l->was_hashed || has_wild || l->marker != MRK_NONE) {  
                 fprintf(ctx->out, "%s\n", l->line);  
                 if (has_wild && !find_host) {  
                         fprintf(stderr, "%s:%ld: ignoring host name "  
                             "with wildcard: %.64s\n", l->path,  
                             l->linenum, l->hosts);  
                 }  
                 return 0;  
         }  
         /*  
          * Split any comma-separated hostnames from the host list,  
          * hash and store separately.  
          */  
         ohosts = hosts = xstrdup(l->hosts);  
         while ((cp = strsep(&hosts, ",")) != NULL && *cp != '\0') {  
                 if ((hashed = host_hash(cp, NULL, 0)) == NULL)  
                         fatal("hash_host failed");  
                 fprintf(ctx->out, "%s %s\n", hashed, l->rawkey);  
                 ctx->has_unhashed = 1;  
         }  
         free(ohosts);  
         return 0;  
 }  }
   
 static int  static int
Line 1074 
Line 1081 
 {  {
         struct known_hosts_ctx *ctx = (struct known_hosts_ctx *)_ctx;          struct known_hosts_ctx *ctx = (struct known_hosts_ctx *)_ctx;
   
         if (l->status == HKF_STATUS_HOST_MATCHED) {          if (l->status == HKF_STATUS_MATCHED) {
                 if (delete_host) {                  if (delete_host) {
                         if (l->marker != MRK_NONE) {                          if (l->marker != MRK_NONE) {
                                 /* Don't remove CA and revocation lines */                                  /* Don't remove CA and revocation lines */
Line 1161 
Line 1168 
         /* XXX support identity_file == "-" for stdin */          /* XXX support identity_file == "-" for stdin */
         if ((r = hostkeys_foreach(identity_file,          if ((r = hostkeys_foreach(identity_file,
             hash_hosts ? known_hosts_hash : known_hosts_find_delete, &ctx,              hash_hosts ? known_hosts_hash : known_hosts_find_delete, &ctx,
             name, find_host ? HKF_WANT_MATCH_HOST : 0)) != 0)              name, NULL, find_host ? HKF_WANT_MATCH : 0)) != 0)
                 fatal("%s: hostkeys_foreach failed: %s", __func__, ssh_err(r));                  fatal("%s: hostkeys_foreach failed: %s", __func__, ssh_err(r));
   
         if (inplace)          if (inplace)

Legend:
Removed from v.1.261  
changed lines
  Added in v.1.262