[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.32 and 1.33

version 1.32, 2001/04/08 13:03:00 version 1.33, 2001/04/09 15:12:23
Line 49 
Line 49 
 #include "pathnames.h"  #include "pathnames.h"
 #include "readpass.h"  #include "readpass.h"
   
   /* we keep a cache of one passphrases */
   static char *pass = NULL;
 void  void
   clear_pass(void)
   {
           if (pass) {
                   memset(pass, 0, strlen(pass));
                   xfree(pass);
                   pass = NULL;
           }
   }
   
   void
 delete_file(AuthenticationConnection *ac, const char *filename)  delete_file(AuthenticationConnection *ac, const char *filename)
 {  {
         Key *public;          Key *public;
Line 130 
Line 142 
 {  {
         struct stat st;          struct stat st;
         Key *private;          Key *private;
         char *comment = NULL, *askpass = NULL, *pass;          char *comment = NULL, *askpass = NULL;
         char buf[1024], msg[1024];          char buf[1024], msg[1024];
         int interactive = isatty(STDIN_FILENO);          int interactive = isatty(STDIN_FILENO);
   
Line 149 
Line 161 
         private = key_load_private(filename, "", &comment);          private = key_load_private(filename, "", &comment);
         if (comment == NULL)          if (comment == NULL)
                 comment = xstrdup(filename);                  comment = xstrdup(filename);
           /* try last */
           if (private == NULL && pass != NULL)
                   private = key_load_private(filename, pass, NULL);
         if (private == NULL) {          if (private == NULL) {
                   /* clear passphrase since it did not work */
                   clear_pass();
                 printf("Need passphrase for %.200s\n", filename);                  printf("Need passphrase for %.200s\n", filename);
                 if (!interactive && askpass == NULL) {                  if (!interactive && askpass == NULL) {
                         xfree(comment);                          xfree(comment);
Line 169 
Line 186 
                                 return;                                  return;
                         }                          }
                         private = key_load_private(filename, pass, &comment);                          private = key_load_private(filename, pass, &comment);
                         memset(pass, 0, strlen(pass));  
                         xfree(pass);  
                         if (private != NULL)                          if (private != NULL)
                                 break;                                  break;
                           clear_pass();
                         strlcpy(msg, "Bad passphrase, try again", sizeof msg);                          strlcpy(msg, "Bad passphrase, try again", sizeof msg);
                 }                  }
         }          }
Line 271 
Line 287 
                 else                  else
                         add_file(ac, buf);                          add_file(ac, buf);
         }          }
           clear_pass();
         ssh_close_authentication_connection(ac);          ssh_close_authentication_connection(ac);
         exit(0);          exit(0);
 }  }

Legend:
Removed from v.1.32  
changed lines
  Added in v.1.33