mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-04 09:09:56 +00:00
Add the other half of the salt-generating code. No functional
difference except that the salt is slightly harder to build dictionaries against, and the code does not use srandom[dev]().
This commit is contained in:
parent
4e8af28d5b
commit
21e5d74291
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=90155
@ -668,15 +668,14 @@ yp_passwd(const char *user, const char *pass)
|
||||
syslog(LOG_ERR, "cannot set password cipher");
|
||||
login_close(lc);
|
||||
/* Salt suitable for anything */
|
||||
srandomdev();
|
||||
gettimeofday(&tv, 0);
|
||||
to64(&salt[0], random(), 3);
|
||||
to64(&salt[3], tv.tv_usec, 3);
|
||||
to64(&salt[6], tv.tv_sec, 2);
|
||||
to64(&salt[8], random(), 5);
|
||||
to64(&salt[13], random(), 5);
|
||||
to64(&salt[17], random(), 5);
|
||||
to64(&salt[22], random(), 5);
|
||||
to64(&salt[0], (tv.tv_sec ^ random()) * tv.tv_usec, 3);
|
||||
to64(&salt[3], (getpid() ^ random()) * tv.tv_usec, 2);
|
||||
to64(&salt[5], (getppid() ^ random()) * tv.tv_usec, 3);
|
||||
to64(&salt[8], (getuid() ^ random()) * tv.tv_usec, 5);
|
||||
to64(&salt[13], (getgid() ^ random()) * tv.tv_usec, 5);
|
||||
to64(&salt[17], random() * tv.tv_usec, 5);
|
||||
to64(&salt[22], random() * tv.tv_usec, 5);
|
||||
salt[27] = '\0';
|
||||
|
||||
if (suser_override)
|
||||
|
Loading…
Reference in New Issue
Block a user