summaryrefslogtreecommitdiff
path: root/lib/libpam/modules/pam_unix/pam_unix.c
diff options
context:
space:
mode:
authorMark Murray <markm@FreeBSD.org>2002-02-04 00:28:54 +0000
committerMark Murray <markm@FreeBSD.org>2002-02-04 00:28:54 +0000
commit21e5d74291114d2964649538df50e832f2bdf21d (patch)
tree49a680aa74268957c8e9840ecf4f32da53125457 /lib/libpam/modules/pam_unix/pam_unix.c
parent4e8af28d5bfce02f00c50c52ef7cf7e50fc8c6e3 (diff)
Notes
Diffstat (limited to 'lib/libpam/modules/pam_unix/pam_unix.c')
-rw-r--r--lib/libpam/modules/pam_unix/pam_unix.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/libpam/modules/pam_unix/pam_unix.c b/lib/libpam/modules/pam_unix/pam_unix.c
index 6f5858682beb..6eb443796a21 100644
--- a/lib/libpam/modules/pam_unix/pam_unix.c
+++ b/lib/libpam/modules/pam_unix/pam_unix.c
@@ -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)