[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.461 and 1.462

version 1.461, 2022/12/04 23:50:49 version 1.462, 2023/02/10 04:56:30
Line 1456 
Line 1456 
  */   */
 static int  static int
 do_print_resource_record(struct passwd *pw, char *fname, char *hname,  do_print_resource_record(struct passwd *pw, char *fname, char *hname,
     int print_generic)      int print_generic, char * const *opts, size_t nopts)
 {  {
         struct sshkey *public;          struct sshkey *public;
         char *comment = NULL;          char *comment = NULL;
         struct stat st;          struct stat st;
         int r;          int r, hash = -1;
           size_t i;
   
           for (i = 0; i < nopts; i++) {
                   if (strncasecmp(opts[i], "hashalg=", 8) == 0) {
                           if ((hash = ssh_digest_alg_by_name(opts[i] + 8)) == -1)
                                   fatal("Unsupported hash algorithm");
                   } else {
                           error("Invalid option \"%s\"", opts[i]);
                           return SSH_ERR_INVALID_ARGUMENT;
                   }
           }
         if (fname == NULL)          if (fname == NULL)
                 fatal_f("no filename");                  fatal_f("no filename");
         if (stat(fname, &st) == -1) {          if (stat(fname, &st) == -1) {
Line 1472 
Line 1482 
         }          }
         if ((r = sshkey_load_public(fname, &public, &comment)) != 0)          if ((r = sshkey_load_public(fname, &public, &comment)) != 0)
                 fatal_r(r, "Failed to read v2 public key from \"%s\"", fname);                  fatal_r(r, "Failed to read v2 public key from \"%s\"", fname);
         export_dns_rr(hname, public, stdout, print_generic);          export_dns_rr(hname, public, stdout, print_generic, hash);
         sshkey_free(public);          sshkey_free(public);
         free(comment);          free(comment);
         return 1;          return 1;
Line 3699 
Line 3709 
   
                 if (have_identity) {                  if (have_identity) {
                         n = do_print_resource_record(pw, identity_file,                          n = do_print_resource_record(pw, identity_file,
                             rr_hostname, print_generic);                              rr_hostname, print_generic, opts, nopts);
                         if (n == 0)                          if (n == 0)
                                 fatal("%s: %s", identity_file, strerror(errno));                                  fatal("%s: %s", identity_file, strerror(errno));
                         exit(0);                          exit(0);
Line 3707 
Line 3717 
   
                         n += do_print_resource_record(pw,                          n += do_print_resource_record(pw,
                             _PATH_HOST_RSA_KEY_FILE, rr_hostname,                              _PATH_HOST_RSA_KEY_FILE, rr_hostname,
                             print_generic);                              print_generic, opts, nopts);
                         n += do_print_resource_record(pw,                          n += do_print_resource_record(pw,
                             _PATH_HOST_DSA_KEY_FILE, rr_hostname,                              _PATH_HOST_DSA_KEY_FILE, rr_hostname,
                             print_generic);                              print_generic, opts, nopts);
                         n += do_print_resource_record(pw,                          n += do_print_resource_record(pw,
                             _PATH_HOST_ECDSA_KEY_FILE, rr_hostname,                              _PATH_HOST_ECDSA_KEY_FILE, rr_hostname,
                             print_generic);                              print_generic, opts, nopts);
                         n += do_print_resource_record(pw,                          n += do_print_resource_record(pw,
                             _PATH_HOST_ED25519_KEY_FILE, rr_hostname,                              _PATH_HOST_ED25519_KEY_FILE, rr_hostname,
                             print_generic);                              print_generic, opts, nopts);
                         n += do_print_resource_record(pw,                          n += do_print_resource_record(pw,
                             _PATH_HOST_XMSS_KEY_FILE, rr_hostname,                              _PATH_HOST_XMSS_KEY_FILE, rr_hostname,
                             print_generic);                              print_generic, opts, nopts);
                         if (n == 0)                          if (n == 0)
                                 fatal("no keys found.");                                  fatal("no keys found.");
                         exit(0);                          exit(0);

Legend:
Removed from v.1.461  
changed lines
  Added in v.1.462