[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.410 and 1.413

version 1.410, 2020/05/13 09:55:57 version 1.413, 2020/06/26 05:02:03
Line 2916 
Line 2916 
 {  {
         struct sshkey **keys;          struct sshkey **keys;
         size_t nkeys, i;          size_t nkeys, i;
         int r, ok = -1;          int r, ret = -1;
         char *fp, *pin = NULL, *pass = NULL, *path, *pubpath;          char *fp, *pin = NULL, *pass = NULL, *path, *pubpath;
         const char *ext;          const char *ext;
   
Line 2932 
Line 2932 
                     &keys, &nkeys)) != 0) {                      &keys, &nkeys)) != 0) {
                         if (i == 0 && r == SSH_ERR_KEY_WRONG_PASSPHRASE)                          if (i == 0 && r == SSH_ERR_KEY_WRONG_PASSPHRASE)
                                 continue;                                  continue;
                         freezero(pin, strlen(pin));                          if (pin != NULL)
                                   freezero(pin, strlen(pin));
                         error("Unable to load resident keys: %s", ssh_err(r));                          error("Unable to load resident keys: %s", ssh_err(r));
                         return -1;                          return -1;
                 }                  }
         }          }
         if (nkeys == 0)          if (nkeys == 0)
                 logit("No keys to download");                  logit("No keys to download");
         freezero(pin, strlen(pin));          if (pin != NULL)
                   freezero(pin, strlen(pin));
   
         for (i = 0; i < nkeys; i++) {          for (i = 0; i < nkeys; i++) {
                 if (keys[i]->type != KEY_ECDSA_SK &&                  if (keys[i]->type != KEY_ECDSA_SK &&
Line 2998 
Line 3000 
         }          }
   
         if (i >= nkeys)          if (i >= nkeys)
                 ok = 0; /* success */                  ret = 0; /* success */
         if (pass != NULL)          if (pass != NULL)
                 freezero(pass, strlen(pass));                  freezero(pass, strlen(pass));
         for (i = 0; i < nkeys; i++)          for (i = 0; i < nkeys; i++)
                 sshkey_free(keys[i]);                  sshkey_free(keys[i]);
         free(keys);          free(keys);
         return ok ? 0 : -1;          return ret;
 }  }
   
 static void  static void
Line 3058 
Line 3060 
 int  int
 main(int argc, char **argv)  main(int argc, char **argv)
 {  {
         char dotsshdir[PATH_MAX], comment[1024], *passphrase;          char comment[1024], *passphrase;
         char *rr_hostname = NULL, *ep, *fp, *ra;          char *rr_hostname = NULL, *ep, *fp, *ra;
         struct sshkey *private, *public;          struct sshkey *private, *public;
         struct passwd *pw;          struct passwd *pw;
         struct stat st;  
         int r, opt, type;          int r, opt, type;
         int change_passphrase = 0, change_comment = 0, show_cert = 0;          int change_passphrase = 0, change_comment = 0, show_cert = 0;
         int find_host = 0, delete_host = 0, hash_hosts = 0;          int find_host = 0, delete_host = 0, hash_hosts = 0;
Line 3582 
Line 3583 
                 ask_filename(pw, "Enter file in which to save the key");                  ask_filename(pw, "Enter file in which to save the key");
   
         /* Create ~/.ssh directory if it doesn't already exist. */          /* Create ~/.ssh directory if it doesn't already exist. */
         snprintf(dotsshdir, sizeof dotsshdir, "%s/%s",          hostfile_create_user_ssh_dir(identity_file, !quiet);
             pw->pw_dir, _PATH_SSH_USER_DIR);  
         if (strstr(identity_file, dotsshdir) != NULL) {  
                 if (stat(dotsshdir, &st) == -1) {  
                         if (errno != ENOENT) {  
                                 error("Could not stat %s: %s", dotsshdir,  
                                     strerror(errno));  
                         } else if (mkdir(dotsshdir, 0700) == -1) {  
                                 error("Could not create directory '%s': %s",  
                                     dotsshdir, strerror(errno));  
                         } else if (!quiet)  
                                 printf("Created directory '%s'.\n", dotsshdir);  
                 }  
         }  
         /* If the file already exists, ask the user to confirm. */          /* If the file already exists, ask the user to confirm. */
         if (!confirm_overwrite(identity_file))          if (!confirm_overwrite(identity_file))
                 exit(1);                  exit(1);

Legend:
Removed from v.1.410  
changed lines
  Added in v.1.413