[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.54 and 1.54.2.2

version 1.54, 2003/05/24 09:30:39 version 1.54.2.2, 2004/08/19 22:37:30
Line 72 
Line 72 
         int fd, i, cipher_num;          int fd, i, cipher_num;
         CipherContext ciphercontext;          CipherContext ciphercontext;
         Cipher *cipher;          Cipher *cipher;
         u_int32_t rand;          u_int32_t rnd;
   
         /*          /*
          * If the passphrase is empty, use SSH_CIPHER_NONE to ease converting           * If the passphrase is empty, use SSH_CIPHER_NONE to ease converting
Line 87 
Line 87 
         buffer_init(&buffer);          buffer_init(&buffer);
   
         /* Put checkbytes for checking passphrase validity. */          /* Put checkbytes for checking passphrase validity. */
         rand = arc4random();          rnd = arc4random();
         buf[0] = rand & 0xff;          buf[0] = rnd & 0xff;
         buf[1] = (rand >> 8) & 0xff;          buf[1] = (rnd >> 8) & 0xff;
         buf[2] = buf[0];          buf[2] = buf[0];
         buf[3] = buf[1];          buf[3] = buf[1];
         buffer_append(&buffer, buf, 4);          buffer_append(&buffer, buf, 4);
Line 143 
Line 143 
         fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0600);          fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0600);
         if (fd < 0) {          if (fd < 0) {
                 error("open %s failed: %s.", filename, strerror(errno));                  error("open %s failed: %s.", filename, strerror(errno));
                   buffer_free(&encrypted);
                 return 0;                  return 0;
         }          }
         if (write(fd, buffer_ptr(&encrypted), buffer_len(&encrypted)) !=          if (write(fd, buffer_ptr(&encrypted), buffer_len(&encrypted)) !=
Line 235 
Line 236 
         struct stat st;          struct stat st;
         char *cp;          char *cp;
         int i;          int i;
         off_t len;          size_t len;
   
         if (fstat(fd, &st) < 0) {          if (fstat(fd, &st) < 0) {
                 error("fstat for key file %.200s failed: %.100s",                  error("fstat for key file %.200s failed: %.100s",
                     filename, strerror(errno));                      filename, strerror(errno));
                 return NULL;                  return NULL;
         }          }
         len = st.st_size;          if (st.st_size > 1*1024*1024)
                   close(fd);
           len = (size_t)st.st_size;               /* truncated */
   
         buffer_init(&buffer);          buffer_init(&buffer);
         cp = buffer_append_space(&buffer, len);          cp = buffer_append_space(&buffer, len);
Line 317 
Line 320 
     char **commentp)      char **commentp)
 {  {
         int i, check1, check2, cipher_type;          int i, check1, check2, cipher_type;
         off_t len;          size_t len;
         Buffer buffer, decrypted;          Buffer buffer, decrypted;
         u_char *cp;          u_char *cp;
         CipherContext ciphercontext;          CipherContext ciphercontext;
Line 331 
Line 334 
                 close(fd);                  close(fd);
                 return NULL;                  return NULL;
         }          }
         len = st.st_size;          if (st.st_size > 1*1024*1024) {
                   close(fd);
                   return (NULL);
           }
           len = (size_t)st.st_size;               /* truncated */
   
         buffer_init(&buffer);          buffer_init(&buffer);
         cp = buffer_append_space(&buffer, len);          cp = buffer_append_space(&buffer, len);

Legend:
Removed from v.1.54  
changed lines
  Added in v.1.54.2.2