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

Diff for /src/usr.bin/ssh/ssh-add.c between version 1.123 and 1.124

version 1.123, 2015/07/03 03:43:18 version 1.124, 2015/09/13 13:48:19
Line 85 
Line 85 
 /* User has to confirm key use */  /* User has to confirm key use */
 static int confirm = 0;  static int confirm = 0;
   
 /* we keep a cache of one passphrases */  /* we keep a cache of one passphrase */
 static char *pass = NULL;  static char *pass = NULL;
 static void  static void
 clear_pass(void)  clear_pass(void)
Line 226 
Line 226 
                         goto fail_load;                          goto fail_load;
                 }                  }
         }          }
         if (comment == NULL)  
                 comment = xstrdup(filename);  
         if (private == NULL) {          if (private == NULL) {
                 /* clear passphrase since it did not work */                  /* clear passphrase since it did not work */
                 clear_pass();                  clear_pass();
                 snprintf(msg, sizeof msg, "Enter passphrase for %.200s%s: ",                  snprintf(msg, sizeof msg, "Enter passphrase for %s%s: ",
                     comment, confirm ? " (will confirm each use)" : "");                      filename, confirm ? " (will confirm each use)" : "");
                 for (;;) {                  for (;;) {
                         pass = read_passphrase(msg, RP_ALLOW_STDIN);                          pass = read_passphrase(msg, RP_ALLOW_STDIN);
                         if (strcmp(pass, "") == 0)                          if (strcmp(pass, "") == 0)
                                 goto fail_load;                                  goto fail_load;
                         if ((r = sshkey_parse_private_fileblob(keyblob, pass,                          if ((r = sshkey_parse_private_fileblob(keyblob, pass,
                             filename, &private, NULL)) == 0)                              filename, &private, &comment)) == 0)
                                 break;                                  break;
                         else if (r != SSH_ERR_KEY_WRONG_PASSPHRASE) {                          else if (r != SSH_ERR_KEY_WRONG_PASSPHRASE) {
                                 fprintf(stderr,                                  fprintf(stderr,
Line 246 
Line 244 
                                     filename, ssh_err(r));                                      filename, ssh_err(r));
  fail_load:   fail_load:
                                 clear_pass();                                  clear_pass();
                                 free(comment);  
                                 sshbuf_free(keyblob);                                  sshbuf_free(keyblob);
                                 return -1;                                  return -1;
                         }                          }
                         clear_pass();                          clear_pass();
                         snprintf(msg, sizeof msg,                          snprintf(msg, sizeof msg,
                             "Bad passphrase, try again for %.200s%s: ", comment,                              "Bad passphrase, try again for %s%s: ", filename,
                             confirm ? " (will confirm each use)" : "");                              confirm ? " (will confirm each use)" : "");
                 }                  }
         }          }
           if (comment == NULL || *comment == '\0')
                   comment = xstrdup(filename);
         sshbuf_free(keyblob);          sshbuf_free(keyblob);
   
         if ((r = ssh_add_identity_constrained(agent_fd, private, comment,          if ((r = ssh_add_identity_constrained(agent_fd, private, comment,

Legend:
Removed from v.1.123  
changed lines
  Added in v.1.124