[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.101 and 1.102

version 1.101, 2011/05/04 21:15:29 version 1.102, 2011/10/18 05:00:48
Line 133 
Line 133 
 }  }
   
 static int  static int
 add_file(AuthenticationConnection *ac, const char *filename)  add_file(AuthenticationConnection *ac, const char *filename, int key_only)
 {  {
         Key *private, *cert;          Key *private, *cert;
         char *comment = NULL;          char *comment = NULL;
         char msg[1024], *certpath;          char msg[1024], *certpath = NULL;
         int fd, perms_ok, ret = -1;          int fd, perms_ok, ret = -1;
         Buffer keyblob;          Buffer keyblob;
   
Line 213 
Line 213 
                 fprintf(stderr, "Could not add identity: %s\n", filename);                  fprintf(stderr, "Could not add identity: %s\n", filename);
         }          }
   
           /* Skip trying to load the cert if requested */
           if (key_only)
                   goto out;
   
         /* Now try to add the certificate flavour too */          /* Now try to add the certificate flavour too */
         xasprintf(&certpath, "%s-cert.pub", filename);          xasprintf(&certpath, "%s-cert.pub", filename);
Line 247 
Line 250 
         if (confirm != 0)          if (confirm != 0)
                 fprintf(stderr, "The user must confirm each use of the key\n");                  fprintf(stderr, "The user must confirm each use of the key\n");
  out:   out:
         xfree(certpath);          if (certpath != NULL)
                   xfree(certpath);
         xfree(comment);          xfree(comment);
         key_free(private);          key_free(private);
   
Line 341 
Line 345 
 }  }
   
 static int  static int
 do_file(AuthenticationConnection *ac, int deleting, char *file)  do_file(AuthenticationConnection *ac, int deleting, int key_only, char *file)
 {  {
         if (deleting) {          if (deleting) {
                 if (delete_file(ac, file) == -1)                  if (delete_file(ac, file) == -1)
                         return -1;                          return -1;
         } else {          } else {
                 if (add_file(ac, file) == -1)                  if (add_file(ac, file, key_only) == -1)
                         return -1;                          return -1;
         }          }
         return 0;          return 0;
Line 377 
Line 381 
         extern int optind;          extern int optind;
         AuthenticationConnection *ac = NULL;          AuthenticationConnection *ac = NULL;
         char *pkcs11provider = NULL;          char *pkcs11provider = NULL;
         int i, ch, deleting = 0, ret = 0;          int i, ch, deleting = 0, ret = 0, key_only = 0;
   
         /* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */          /* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */
         sanitise_stdfd();          sanitise_stdfd();
Line 391 
Line 395 
                     "Could not open a connection to your authentication agent.\n");                      "Could not open a connection to your authentication agent.\n");
                 exit(2);                  exit(2);
         }          }
         while ((ch = getopt(argc, argv, "lLcdDxXe:s:t:")) != -1) {          while ((ch = getopt(argc, argv, "klLcdDxXe:s:t:")) != -1) {
                 switch (ch) {                  switch (ch) {
                   case 'k':
                           key_only = 1;
                           break;
                 case 'l':                  case 'l':
                 case 'L':                  case 'L':
                         if (list_identities(ac, ch == 'l' ? 1 : 0) == -1)                          if (list_identities(ac, ch == 'l' ? 1 : 0) == -1)
Line 458 
Line 465 
                             default_files[i]);                              default_files[i]);
                         if (stat(buf, &st) < 0)                          if (stat(buf, &st) < 0)
                                 continue;                                  continue;
                         if (do_file(ac, deleting, buf) == -1)                          if (do_file(ac, deleting, key_only, buf) == -1)
                                 ret = 1;                                  ret = 1;
                         else                          else
                                 count++;                                  count++;
Line 467 
Line 474 
                         ret = 1;                          ret = 1;
         } else {          } else {
                 for (i = 0; i < argc; i++) {                  for (i = 0; i < argc; i++) {
                         if (do_file(ac, deleting, argv[i]) == -1)                          if (do_file(ac, deleting, key_only, argv[i]) == -1)
                                 ret = 1;                                  ret = 1;
                 }                  }
         }          }

Legend:
Removed from v.1.101  
changed lines
  Added in v.1.102