]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/magic.c
Patch from Frank Cusack to add support for MSCHAPv2.
[ppp.git] / pppd / magic.c
index 7391b1405df8a52b7649bd3390f2f24bcd06afc1..3c70558359b7d0f532dce8b20cc63b8ecbb511e8 100644 (file)
  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 
-#ifndef lint
-static char rcsid[] = "$Id: magic.c,v 1.4 1995/04/24 05:57:01 paulus Exp $";
-#endif
+#define RCSID  "$Id: magic.c,v 1.9 1999/08/13 06:46:15 paulus Exp $"
 
 #include <stdio.h>
+#include <unistd.h>
 #include <sys/types.h>
 #include <sys/time.h>
 
 #include "pppd.h"
 #include "magic.h"
 
-static u_int32_t next;         /* Next value to return */
+static const char rcsid[] = RCSID;
 
-extern int gethostid __P((void));
 extern long mrand48 __P((void));
 extern void srand48 __P((long));
 
-
 /*
  * magic_init - Initialize the magic number generator.
  *
  * Attempts to compute a random number seed which will not repeat.
- * The current method uses the current hostid and current time, currently.
+ * The current method uses the current hostid, current process ID
+ * and current time, currently.
  */
 void
 magic_init()
 {
     long seed;
+    struct timeval t;
 
-    seed = gethostid() ^ time(NULL);
+    gettimeofday(&t, NULL);
+    seed = get_host_seed() ^ t.tv_sec ^ t.tv_usec ^ getpid();
     srand48(seed);
 }