diff options
author | ache <ache@FreeBSD.org> | 1997-03-10 08:04:15 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1997-03-10 08:04:15 +0000 |
commit | 78da0d5742784dd9287ef11059170ae612c80713 (patch) | |
tree | e47017ec38f0f2299dc9fe7635b50455dc359904 /usr.sbin/ppp/chap.c | |
parent | a340e72bff7cda56735666839b2746c30bc5008e (diff) | |
download | FreeBSD-src-78da0d5742784dd9287ef11059170ae612c80713.zip FreeBSD-src-78da0d5742784dd9287ef11059170ae612c80713.tar.gz |
Do not re-initialize random numbers generator several times.
Use ^ getpid() to produce better initial state.
Diffstat (limited to 'usr.sbin/ppp/chap.c')
-rw-r--r-- | usr.sbin/ppp/chap.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.sbin/ppp/chap.c b/usr.sbin/ppp/chap.c index 39f4c7c..0e30cce 100644 --- a/usr.sbin/ppp/chap.c +++ b/usr.sbin/ppp/chap.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id$ + * $Id: chap.c,v 1.10 1997/02/22 16:10:05 peter Exp $ * * TODO: */ @@ -41,6 +41,7 @@ struct authinfo AuthChapInfo = { }; extern char *AuthGetSecret(); +extern int randinit; void ChapOutput(code, id, ptr, count) @@ -78,7 +79,10 @@ int chapid; int len, i; char *cp; - srandom(time(NULL)); + if (!randinit) { + srandom((unsigned)(time(NULL) ^ getpid())); + randinit = 1; + } cp = challenge_data; *cp++ = challenge_len = random() % 32 + 16; |