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

Diff for /src/usr.bin/passwd/Attic/pwd_gensalt.c between version 1.2 and 1.3

version 1.2, 1997/02/16 20:08:59 version 1.3, 1997/03/27 00:05:41
Line 67 
Line 67 
                 (void) srandom((int) time((time_t *) NULL));                  (void) srandom((int) time((time_t *) NULL));
                 to64(&salt[0], random(), 2);                  to64(&salt[0], random(), 2);
                 salt[2] = '\0';                  salt[2] = '\0';
         } else          } else if (!strcmp(now, "newsalt")) {
                 if (!strcmp(now, "newsalt")) {                  if( max < 10 )
                         if( max < 10 )                          return 0;
                                 return 0;                  (void) srandom((int) time((time_t *) NULL));
                         (void) srandom((int) time((time_t *) NULL));                  salt[0] = _PASSWORD_EFMT1;
                         salt[0] = _PASSWORD_EFMT1;                  to64(&salt[1], (long) (29 * 25), 4);
                         to64(&salt[1], (long) (29 * 25), 4);                  to64(&salt[5], random(), 4);
                         to64(&salt[5], random(), 4);                  salt[9] = '\0';
                         salt[9] = '\0';          } else if (!strcmp(now, "md5")) {
                 } else                  if( max < 13 )  /* $1$8salt$\0 */
                         if (!strcmp(now, "blowfish")) {                          return 0;
                                 int     rounds = atoi(next);                  strcpy(salt, "$1$");
                                 if (rounds < 4)                  (void) srandom((int) time((time_t *) NULL));
                                         rounds = 4;                  to64(&salt[3], random(), 4);
                                 strncpy(salt, bcrypt_gensalt(rounds), max - 1);                  to64(&salt[7], random(), 4);
                                 salt[max - 1] = 0;                  strcpy(&salt[11], "$");
                         } else {          } else if (!strcmp(now, "blowfish")) {
                                 strcpy(salt, ":");                  int     rounds = atoi(next);
                                 warnx("Unkown option %s.", now);                  if (rounds < 4)
                         }                          rounds = 4;
                   strncpy(salt, bcrypt_gensalt(rounds), max - 1);
                   salt[max - 1] = 0;
           } else {
                   strcpy(salt, ":");
                   warnx("Unkown option %s.", now);
           }
         return 1;          return 1;
 }  }
   

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3