[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.131 and 1.132

version 1.131, 2018/09/21 12:20:12 version 1.132, 2019/06/28 13:35:04
Line 55 
Line 55 
 {  {
         int fd, oerrno;          int fd, oerrno;
   
         if ((fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0600)) < 0)          if ((fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0600)) == -1)
                 return SSH_ERR_SYSTEM_ERROR;                  return SSH_ERR_SYSTEM_ERROR;
         if (atomicio(vwrite, fd, sshbuf_mutable_ptr(keybuf),          if (atomicio(vwrite, fd, sshbuf_mutable_ptr(keybuf),
             sshbuf_len(keybuf)) != sshbuf_len(keybuf)) {              sshbuf_len(keybuf)) != sshbuf_len(keybuf)) {
Line 99 
Line 99 
         struct stat st;          struct stat st;
         int r;          int r;
   
         if (fstat(fd, &st) < 0)          if (fstat(fd, &st) == -1)
                 return SSH_ERR_SYSTEM_ERROR;                  return SSH_ERR_SYSTEM_ERROR;
         if ((st.st_mode & (S_IFSOCK|S_IFCHR|S_IFIFO)) == 0 &&          if ((st.st_mode & (S_IFSOCK|S_IFCHR|S_IFIFO)) == 0 &&
             st.st_size > MAX_KEY_FILE_SIZE)              st.st_size > MAX_KEY_FILE_SIZE)
Line 139 
Line 139 
 {  {
         struct stat st;          struct stat st;
   
         if (fstat(fd, &st) < 0)          if (fstat(fd, &st) == -1)
                 return SSH_ERR_SYSTEM_ERROR;                  return SSH_ERR_SYSTEM_ERROR;
         /*          /*
          * if a key owned by the user is accessed, then we check the           * if a key owned by the user is accessed, then we check the
Line 171 
Line 171 
         if (commentp != NULL)          if (commentp != NULL)
                 *commentp = NULL;                  *commentp = NULL;
   
         if ((fd = open(filename, O_RDONLY)) < 0) {          if ((fd = open(filename, O_RDONLY)) == -1) {
                 if (perm_ok != NULL)                  if (perm_ok != NULL)
                         *perm_ok = 0;                          *perm_ok = 0;
                 return SSH_ERR_SYSTEM_ERROR;                  return SSH_ERR_SYSTEM_ERROR;
Line 231 
Line 231 
         if (commentp != NULL)          if (commentp != NULL)
                 *commentp = NULL;                  *commentp = NULL;
   
         if ((fd = open(filename, O_RDONLY)) < 0)          if ((fd = open(filename, O_RDONLY)) == -1)
                 return SSH_ERR_SYSTEM_ERROR;                  return SSH_ERR_SYSTEM_ERROR;
         if (sshkey_perm_ok(fd, filename) != 0) {          if (sshkey_perm_ok(fd, filename) != 0) {
                 r = SSH_ERR_KEY_BAD_PERMISSIONS;                  r = SSH_ERR_KEY_BAD_PERMISSIONS;

Legend:
Removed from v.1.131  
changed lines
  Added in v.1.132