[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.25 and 1.26

version 1.25, 2001/01/21 19:05:44 version 1.26, 2001/01/28 22:27:05
Line 51 
Line 51 
 #include "log.h"  #include "log.h"
   
 /* Version identification string for identity files. */  /* Version identification string for identity files. */
 #define AUTHFILE_ID_STRING "SSH PRIVATE KEY FILE FORMAT 1.1\n"  static const char authfile_id_string[] =
       "SSH PRIVATE KEY FILE FORMAT 1.1\n";
   
 /*  /*
  * Saves the authentication (private) key in a file, encrypting it with   * Saves the authentication (private) key in a file, encrypting it with
Line 111 
Line 112 
         buffer_init(&encrypted);          buffer_init(&encrypted);
   
         /* First store keyfile id string. */          /* First store keyfile id string. */
         cp = AUTHFILE_ID_STRING;          for (i = 0; authfile_id_string[i]; i++)
         for (i = 0; cp[i]; i++)                  buffer_put_char(&encrypted, authfile_id_string[i]);
                 buffer_put_char(&encrypted, cp[i]);  
         buffer_put_char(&encrypted, 0);          buffer_put_char(&encrypted, 0);
   
         /* Store cipher type. */          /* Store cipher type. */
Line 247 
Line 247 
         }          }
         close(fd);          close(fd);
   
         /* Check that it is at least big enought to contain the ID string. */          /* Check that it is at least big enough to contain the ID string. */
         if (len < strlen(AUTHFILE_ID_STRING) + 1) {          if (len < sizeof(authfile_id_string)) {
                 debug3("Bad RSA1 key file %.200s.", filename);                  debug3("Bad RSA1 key file %.200s.", filename);
                 buffer_free(&buffer);                  buffer_free(&buffer);
                 return 0;                  return 0;
Line 257 
Line 257 
          * Make sure it begins with the id string.  Consume the id string           * Make sure it begins with the id string.  Consume the id string
          * from the buffer.           * from the buffer.
          */           */
         for (i = 0; i < (u_int) strlen(AUTHFILE_ID_STRING) + 1; i++)          for (i = 0; i < sizeof(authfile_id_string); i++)
                 if (buffer_get_char(&buffer) != (u_char) AUTHFILE_ID_STRING[i]) {                  if (buffer_get_char(&buffer) != authfile_id_string[i]) {
                         debug3("Bad RSA1 key file %.200s.", filename);                          debug3("Bad RSA1 key file %.200s.", filename);
                         buffer_free(&buffer);                          buffer_free(&buffer);
                         return 0;                          return 0;
Line 337 
Line 337 
         }          }
         close(fd);          close(fd);
   
         /* Check that it is at least big enought to contain the ID string. */          /* Check that it is at least big enough to contain the ID string. */
         if (len < strlen(AUTHFILE_ID_STRING) + 1) {          if (len < sizeof(authfile_id_string)) {
                 debug3("Bad RSA1 key file %.200s.", filename);                  debug3("Bad RSA1 key file %.200s.", filename);
                 buffer_free(&buffer);                  buffer_free(&buffer);
                 return 0;                  return 0;
Line 347 
Line 347 
          * Make sure it begins with the id string.  Consume the id string           * Make sure it begins with the id string.  Consume the id string
          * from the buffer.           * from the buffer.
          */           */
         for (i = 0; i < (u_int) strlen(AUTHFILE_ID_STRING) + 1; i++)          for (i = 0; i < sizeof(authfile_id_string); i++)
                 if (buffer_get_char(&buffer) != (u_char) AUTHFILE_ID_STRING[i]) {                  if (buffer_get_char(&buffer) != authfile_id_string[i]) {
                         debug3("Bad RSA1 key file %.200s.", filename);                          debug3("Bad RSA1 key file %.200s.", filename);
                         buffer_free(&buffer);                          buffer_free(&buffer);
                         return 0;                          return 0;

Legend:
Removed from v.1.25  
changed lines
  Added in v.1.26