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

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

version 1.123, 2017/03/26 00:18:52 version 1.124, 2017/04/30 23:10:43
Line 145 
Line 145 
         return r;          return r;
 }  }
   
 #ifdef WITH_SSH1  
 /*  
  * Loads the public part of the ssh v1 key file.  Returns NULL if an error was  
  * encountered (the file does not exist or is not readable), and the key  
  * otherwise.  
  */  
 static int  
 sshkey_load_public_rsa1(int fd, struct sshkey **keyp, char **commentp)  
 {  
         struct sshbuf *b = NULL;  
         int r;  
   
         if (keyp != NULL)  
                 *keyp = NULL;  
         if (commentp != NULL)  
                 *commentp = NULL;  
   
         if ((b = sshbuf_new()) == NULL)  
                 return SSH_ERR_ALLOC_FAIL;  
         if ((r = sshkey_load_file(fd, b)) != 0)  
                 goto out;  
         if ((r = sshkey_parse_public_rsa1_fileblob(b, keyp, commentp)) != 0)  
                 goto out;  
         r = 0;  
  out:  
         sshbuf_free(b);  
         return r;  
 }  
 #endif /* WITH_SSH1 */  
   
 /* XXX remove error() calls from here? */  /* XXX remove error() calls from here? */
 int  int
 sshkey_perm_ok(int fd, const char *filename)  sshkey_perm_ok(int fd, const char *filename)
Line 357 
Line 328 
   
         if ((fd = open(filename, O_RDONLY)) < 0)          if ((fd = open(filename, O_RDONLY)) < 0)
                 goto skip;                  goto skip;
 #ifdef WITH_SSH1  
         /* try rsa1 private key */  
         r = sshkey_load_public_rsa1(fd, keyp, commentp);  
         close(fd);          close(fd);
         switch (r) {  
         case SSH_ERR_INTERNAL_ERROR:  
         case SSH_ERR_ALLOC_FAIL:  
         case SSH_ERR_INVALID_ARGUMENT:  
         case SSH_ERR_SYSTEM_ERROR:  
         case 0:  
                 return r;  
         }  
 #else /* WITH_SSH1 */  
         close(fd);  
 #endif /* WITH_SSH1 */  
   
         /* try ssh2 public key */          /* try ssh2 public key */
         if ((pub = sshkey_new(KEY_UNSPEC)) == NULL)          if ((pub = sshkey_new(KEY_UNSPEC)) == NULL)
Line 383 
Line 340 
         }          }
         sshkey_free(pub);          sshkey_free(pub);
   
 #ifdef WITH_SSH1  
         /* try rsa1 public key */  
         if ((pub = sshkey_new(KEY_RSA1)) == NULL)  
                 return SSH_ERR_ALLOC_FAIL;  
         if ((r = sshkey_try_load_public(pub, filename, commentp)) == 0) {  
                 if (keyp != NULL)  
                         *keyp = pub;  
                 return 0;  
         }  
         sshkey_free(pub);  
 #endif /* WITH_SSH1 */  
   
  skip:   skip:
         /* try .pub suffix */          /* try .pub suffix */

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