+2007-11-23 Nicolas François <nicolas.francois@centraliens.net>
+
+ * libmisc/salt.c: Move the srandom call to gensalt.
+ * libmisc/salt.c (gensalt): Replace the test on salt_size by an
+ assert.
+
2007-11-23 Nicolas François <nicolas.francois@centraliens.net>
Patch contributed by Dan Kopecek <dkopecek@redhat.com>
salt[0] = '\0';
- if (salt_size >= MIN_SALT_SIZE &&
- salt_size <= MAX_SALT_SIZE) {
+ assert (salt_size >= MIN_SALT_SIZE &&
+ salt_size <= MAX_SALT_SIZE);
+ srandom ((unsigned int)time(NULL));
strcat (salt, l64a (random()));
do {
strcat (salt, l64a (random()));
} while (strlen (salt) < salt_size);
salt[salt_size] = '\0';
- }
return salt;
}
* Concatenate a pseudo random salt.
*/
assert (sizeof (result) > strlen (result) + salt_len);
- srandom ((unsigned int)time(NULL));
strncat (result, gensalt (salt_len),
sizeof (result) - strlen (result) - 1);